From 06e6919f1052dfb561dad4624d610f8265f4b5b7 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 17 Nov 2023 14:48:20 -0600 Subject: [PATCH] Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord --- package.json | 2 +- .../registry/v1beta1/attributes.proto | 38 + .../cosmos/base/query/v1beta1/pagination.ts | 6 +- src/proto/cosmos/base/v1beta1/coin.ts | 2 +- src/proto/gogoproto/gogo.ts | 2 +- src/proto/google/api/annotations.ts | 2 +- src/proto/google/api/http.ts | 2 +- src/proto/google/protobuf/any.ts | 4 +- src/proto/google/protobuf/descriptor.ts | 4 +- src/proto/google/protobuf/duration.ts | 2 +- src/proto/google/protobuf/timestamp.ts | 2 +- .../vulcanize/auction/v1beta1/genesis.ts | 2 +- src/proto/vulcanize/auction/v1beta1/query.ts | 2 +- src/proto/vulcanize/auction/v1beta1/tx.ts | 2 +- src/proto/vulcanize/auction/v1beta1/types.ts | 2 +- src/proto/vulcanize/bond/v1beta1/bond.ts | 2 +- src/proto/vulcanize/bond/v1beta1/genesis.ts | 2 +- src/proto/vulcanize/bond/v1beta1/query.ts | 2 +- src/proto/vulcanize/bond/v1beta1/tx.ts | 2 +- .../vulcanize/registry/v1beta1/attributes.ts | 801 +++++++++++++++++- .../vulcanize/registry/v1beta1/genesis.ts | 2 +- src/proto/vulcanize/registry/v1beta1/query.ts | 2 +- .../vulcanize/registry/v1beta1/registry.ts | 2 +- src/proto/vulcanize/registry/v1beta1/tx.ts | 2 +- src/types.ts | 21 +- yarn.lock | 8 +- 26 files changed, 881 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 066347b..d5ad8a4 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "dotenv": "^16.0.0", "google-protobuf": "^3.21.0", "jest": "29.0.0", - "protoc-gen-ts": "^0.8.5", + "protoc-gen-ts": "^0.8.7", "ts-jest": "^29.0.2", "typescript": "^4.6.2" }, diff --git a/proto/vulcanize/registry/v1beta1/attributes.proto b/proto/vulcanize/registry/v1beta1/attributes.proto index c5d2702..a32aac1 100644 --- a/proto/vulcanize/registry/v1beta1/attributes.proto +++ b/proto/vulcanize/registry/v1beta1/attributes.proto @@ -30,4 +30,42 @@ message WebsiteRegistrationRecord { string tls_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""]; string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; +} + +message ApplicationRecord { + string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; + string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""]; + string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""]; + string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; + string homepage = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""]; + string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""]; + string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""]; + string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""]; + string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""]; + string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""]; + string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""]; + string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""]; + repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; +} + +message WebAppDeploymentRecord { + string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; + string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""]; + string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""]; + string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; + string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""]; + string url = 6 [(gogoproto.moretags) = "json:\"\" yaml:\"name\""]; + string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""]; + repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; +} + +message GeneralRecord { + string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; + string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""]; + string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""]; + string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; + string category = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""]; + string value = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""]; + string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""]; + repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""]; } \ No newline at end of file diff --git a/src/proto/cosmos/base/query/v1beta1/pagination.ts b/src/proto/cosmos/base/query/v1beta1/pagination.ts index e596bd5..d559483 100644 --- a/src/proto/cosmos/base/query/v1beta1/pagination.ts +++ b/src/proto/cosmos/base/query/v1beta1/pagination.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: cosmos/base/query/v1beta1/pagination.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; @@ -37,7 +37,7 @@ export namespace cosmos.base.query.v1beta1 { } } get key() { - return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array; + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; } set key(value: Uint8Array) { pb_1.Message.setField(this, 1, value); @@ -184,7 +184,7 @@ export namespace cosmos.base.query.v1beta1 { } } get next_key() { - return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array()) as Uint8Array; + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; } set next_key(value: Uint8Array) { pb_1.Message.setField(this, 1, value); diff --git a/src/proto/cosmos/base/v1beta1/coin.ts b/src/proto/cosmos/base/v1beta1/coin.ts index 2aa2169..51868f6 100644 --- a/src/proto/cosmos/base/v1beta1/coin.ts +++ b/src/proto/cosmos/base/v1beta1/coin.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: cosmos/base/v1beta1/coin.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/gogoproto/gogo.ts b/src/proto/gogoproto/gogo.ts index 862d824..7ef9f53 100644 --- a/src/proto/gogoproto/gogo.ts +++ b/src/proto/gogoproto/gogo.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: gogoproto/gogo.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../google/protobuf/descriptor"; diff --git a/src/proto/google/api/annotations.ts b/src/proto/google/api/annotations.ts index 43c5989..f0a1bf7 100644 --- a/src/proto/google/api/annotations.ts +++ b/src/proto/google/api/annotations.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/api/annotations.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./http"; diff --git a/src/proto/google/api/http.ts b/src/proto/google/api/http.ts index 6280850..2ce7e5b 100644 --- a/src/proto/google/api/http.ts +++ b/src/proto/google/api/http.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/api/http.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; diff --git a/src/proto/google/protobuf/any.ts b/src/proto/google/protobuf/any.ts index 16c08b5..002aebc 100644 --- a/src/proto/google/protobuf/any.ts +++ b/src/proto/google/protobuf/any.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/protobuf/any.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../gogoproto/gogo"; @@ -32,7 +32,7 @@ export namespace google.protobuf { pb_1.Message.setField(this, 1, value); } get value() { - return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array()) as Uint8Array; + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; } set value(value: Uint8Array) { pb_1.Message.setField(this, 2, value); diff --git a/src/proto/google/protobuf/descriptor.ts b/src/proto/google/protobuf/descriptor.ts index b58970e..7938a29 100644 --- a/src/proto/google/protobuf/descriptor.ts +++ b/src/proto/google/protobuf/descriptor.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/protobuf/descriptor.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; @@ -3604,7 +3604,7 @@ export namespace google.protobuf { return pb_1.Message.getField(this, 6) != null; } get string_value() { - return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array()) as Uint8Array; + return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array; } set string_value(value: Uint8Array) { pb_1.Message.setField(this, 7, value); diff --git a/src/proto/google/protobuf/duration.ts b/src/proto/google/protobuf/duration.ts index 60b5bbb..0907867 100644 --- a/src/proto/google/protobuf/duration.ts +++ b/src/proto/google/protobuf/duration.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/protobuf/duration.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; diff --git a/src/proto/google/protobuf/timestamp.ts b/src/proto/google/protobuf/timestamp.ts index 57b6456..27bfd0c 100644 --- a/src/proto/google/protobuf/timestamp.ts +++ b/src/proto/google/protobuf/timestamp.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: google/protobuf/timestamp.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; diff --git a/src/proto/vulcanize/auction/v1beta1/genesis.ts b/src/proto/vulcanize/auction/v1beta1/genesis.ts index 71963a7..cdc73d4 100644 --- a/src/proto/vulcanize/auction/v1beta1/genesis.ts +++ b/src/proto/vulcanize/auction/v1beta1/genesis.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/auction/v1beta1/genesis.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/auction/v1beta1/query.ts b/src/proto/vulcanize/auction/v1beta1/query.ts index 5861ba9..e87e058 100644 --- a/src/proto/vulcanize/auction/v1beta1/query.ts +++ b/src/proto/vulcanize/auction/v1beta1/query.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/auction/v1beta1/query.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/auction/v1beta1/tx.ts b/src/proto/vulcanize/auction/v1beta1/tx.ts index 07444f2..d99edf2 100644 --- a/src/proto/vulcanize/auction/v1beta1/tx.ts +++ b/src/proto/vulcanize/auction/v1beta1/tx.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/auction/v1beta1/tx.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/auction/v1beta1/types.ts b/src/proto/vulcanize/auction/v1beta1/types.ts index ef54a88..463f420 100644 --- a/src/proto/vulcanize/auction/v1beta1/types.ts +++ b/src/proto/vulcanize/auction/v1beta1/types.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/auction/v1beta1/types.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/bond/v1beta1/bond.ts b/src/proto/vulcanize/bond/v1beta1/bond.ts index 43ec165..17d554e 100644 --- a/src/proto/vulcanize/bond/v1beta1/bond.ts +++ b/src/proto/vulcanize/bond/v1beta1/bond.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/bond/v1beta1/bond.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/bond/v1beta1/genesis.ts b/src/proto/vulcanize/bond/v1beta1/genesis.ts index 84df411..25c9246 100644 --- a/src/proto/vulcanize/bond/v1beta1/genesis.ts +++ b/src/proto/vulcanize/bond/v1beta1/genesis.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/bond/v1beta1/genesis.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/bond/v1beta1/query.ts b/src/proto/vulcanize/bond/v1beta1/query.ts index 14ca51f..9ad716d 100644 --- a/src/proto/vulcanize/bond/v1beta1/query.ts +++ b/src/proto/vulcanize/bond/v1beta1/query.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/bond/v1beta1/query.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/bond/v1beta1/tx.ts b/src/proto/vulcanize/bond/v1beta1/tx.ts index d75ff91..28bd760 100644 --- a/src/proto/vulcanize/bond/v1beta1/tx.ts +++ b/src/proto/vulcanize/bond/v1beta1/tx.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/bond/v1beta1/tx.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/registry/v1beta1/attributes.ts b/src/proto/vulcanize/registry/v1beta1/attributes.ts index c9aff83..6a88761 100644 --- a/src/proto/vulcanize/registry/v1beta1/attributes.ts +++ b/src/proto/vulcanize/registry/v1beta1/attributes.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/registry/v1beta1/attributes.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; @@ -534,4 +534,803 @@ export namespace vulcanize.registry.v1beta1 { return WebsiteRegistrationRecord.deserialize(bytes); } } + export class ApplicationRecord extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + type?: string; + name?: string; + description?: string; + version?: string; + homepage?: string; + license?: string; + author?: string; + repository?: string; + repository_tag?: string; + app_version?: string; + app_type?: string; + meta?: string; + tags?: string[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [21], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("name" in data && data.name != undefined) { + this.name = data.name; + } + if ("description" in data && data.description != undefined) { + this.description = data.description; + } + if ("version" in data && data.version != undefined) { + this.version = data.version; + } + if ("homepage" in data && data.homepage != undefined) { + this.homepage = data.homepage; + } + if ("license" in data && data.license != undefined) { + this.license = data.license; + } + if ("author" in data && data.author != undefined) { + this.author = data.author; + } + if ("repository" in data && data.repository != undefined) { + this.repository = data.repository; + } + if ("repository_tag" in data && data.repository_tag != undefined) { + this.repository_tag = data.repository_tag; + } + if ("app_version" in data && data.app_version != undefined) { + this.app_version = data.app_version; + } + if ("app_type" in data && data.app_type != undefined) { + this.app_type = data.app_type; + } + if ("meta" in data && data.meta != undefined) { + this.meta = data.meta; + } + if ("tags" in data && data.tags != undefined) { + this.tags = data.tags; + } + } + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set type(value: string) { + pb_1.Message.setField(this, 1, value); + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set name(value: string) { + pb_1.Message.setField(this, 2, value); + } + get description() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set description(value: string) { + pb_1.Message.setField(this, 3, value); + } + get version() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set version(value: string) { + pb_1.Message.setField(this, 4, value); + } + get homepage() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set homepage(value: string) { + pb_1.Message.setField(this, 5, value); + } + get license() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set license(value: string) { + pb_1.Message.setField(this, 6, value); + } + get author() { + return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + } + set author(value: string) { + pb_1.Message.setField(this, 7, value); + } + get repository() { + return pb_1.Message.getFieldWithDefault(this, 8, "") as string; + } + set repository(value: string) { + pb_1.Message.setField(this, 8, value); + } + get repository_tag() { + return pb_1.Message.getFieldWithDefault(this, 9, "") as string; + } + set repository_tag(value: string) { + pb_1.Message.setField(this, 9, value); + } + get app_version() { + return pb_1.Message.getFieldWithDefault(this, 10, "") as string; + } + set app_version(value: string) { + pb_1.Message.setField(this, 10, value); + } + get app_type() { + return pb_1.Message.getFieldWithDefault(this, 11, "") as string; + } + set app_type(value: string) { + pb_1.Message.setField(this, 11, value); + } + get meta() { + return pb_1.Message.getFieldWithDefault(this, 20, "") as string; + } + set meta(value: string) { + pb_1.Message.setField(this, 20, value); + } + get tags() { + return pb_1.Message.getFieldWithDefault(this, 21, []) as string[]; + } + set tags(value: string[]) { + pb_1.Message.setField(this, 21, value); + } + static fromObject(data: { + type?: string; + name?: string; + description?: string; + version?: string; + homepage?: string; + license?: string; + author?: string; + repository?: string; + repository_tag?: string; + app_version?: string; + app_type?: string; + meta?: string; + tags?: string[]; + }): ApplicationRecord { + const message = new ApplicationRecord({}); + if (data.type != null) { + message.type = data.type; + } + if (data.name != null) { + message.name = data.name; + } + if (data.description != null) { + message.description = data.description; + } + if (data.version != null) { + message.version = data.version; + } + if (data.homepage != null) { + message.homepage = data.homepage; + } + if (data.license != null) { + message.license = data.license; + } + if (data.author != null) { + message.author = data.author; + } + if (data.repository != null) { + message.repository = data.repository; + } + if (data.repository_tag != null) { + message.repository_tag = data.repository_tag; + } + if (data.app_version != null) { + message.app_version = data.app_version; + } + if (data.app_type != null) { + message.app_type = data.app_type; + } + if (data.meta != null) { + message.meta = data.meta; + } + if (data.tags != null) { + message.tags = data.tags; + } + return message; + } + toObject() { + const data: { + type?: string; + name?: string; + description?: string; + version?: string; + homepage?: string; + license?: string; + author?: string; + repository?: string; + repository_tag?: string; + app_version?: string; + app_type?: string; + meta?: string; + tags?: string[]; + } = {}; + if (this.type != null) { + data.type = this.type; + } + if (this.name != null) { + data.name = this.name; + } + if (this.description != null) { + data.description = this.description; + } + if (this.version != null) { + data.version = this.version; + } + if (this.homepage != null) { + data.homepage = this.homepage; + } + if (this.license != null) { + data.license = this.license; + } + if (this.author != null) { + data.author = this.author; + } + if (this.repository != null) { + data.repository = this.repository; + } + if (this.repository_tag != null) { + data.repository_tag = this.repository_tag; + } + if (this.app_version != null) { + data.app_version = this.app_version; + } + if (this.app_type != null) { + data.app_type = this.app_type; + } + if (this.meta != null) { + data.meta = this.meta; + } + if (this.tags != null) { + data.tags = this.tags; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.type.length) + writer.writeString(1, this.type); + if (this.name.length) + writer.writeString(2, this.name); + if (this.description.length) + writer.writeString(3, this.description); + if (this.version.length) + writer.writeString(4, this.version); + if (this.homepage.length) + writer.writeString(5, this.homepage); + if (this.license.length) + writer.writeString(6, this.license); + if (this.author.length) + writer.writeString(7, this.author); + if (this.repository.length) + writer.writeString(8, this.repository); + if (this.repository_tag.length) + writer.writeString(9, this.repository_tag); + if (this.app_version.length) + writer.writeString(10, this.app_version); + if (this.app_type.length) + writer.writeString(11, this.app_type); + if (this.meta.length) + writer.writeString(20, this.meta); + if (this.tags.length) + writer.writeRepeatedString(21, this.tags); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ApplicationRecord { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ApplicationRecord(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type = reader.readString(); + break; + case 2: + message.name = reader.readString(); + break; + case 3: + message.description = reader.readString(); + break; + case 4: + message.version = reader.readString(); + break; + case 5: + message.homepage = reader.readString(); + break; + case 6: + message.license = reader.readString(); + break; + case 7: + message.author = reader.readString(); + break; + case 8: + message.repository = reader.readString(); + break; + case 9: + message.repository_tag = reader.readString(); + break; + case 10: + message.app_version = reader.readString(); + break; + case 11: + message.app_type = reader.readString(); + break; + case 20: + message.meta = reader.readString(); + break; + case 21: + pb_1.Message.addToRepeatedField(message, 21, reader.readString()); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ApplicationRecord { + return ApplicationRecord.deserialize(bytes); + } + } + export class WebAppDeploymentRecord extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + type?: string; + name?: string; + description?: string; + version?: string; + application?: string; + url?: string; + meta?: string; + tags?: string[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [21], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("name" in data && data.name != undefined) { + this.name = data.name; + } + if ("description" in data && data.description != undefined) { + this.description = data.description; + } + if ("version" in data && data.version != undefined) { + this.version = data.version; + } + if ("application" in data && data.application != undefined) { + this.application = data.application; + } + if ("url" in data && data.url != undefined) { + this.url = data.url; + } + if ("meta" in data && data.meta != undefined) { + this.meta = data.meta; + } + if ("tags" in data && data.tags != undefined) { + this.tags = data.tags; + } + } + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set type(value: string) { + pb_1.Message.setField(this, 1, value); + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set name(value: string) { + pb_1.Message.setField(this, 2, value); + } + get description() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set description(value: string) { + pb_1.Message.setField(this, 3, value); + } + get version() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set version(value: string) { + pb_1.Message.setField(this, 4, value); + } + get application() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set application(value: string) { + pb_1.Message.setField(this, 5, value); + } + get url() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set url(value: string) { + pb_1.Message.setField(this, 6, value); + } + get meta() { + return pb_1.Message.getFieldWithDefault(this, 20, "") as string; + } + set meta(value: string) { + pb_1.Message.setField(this, 20, value); + } + get tags() { + return pb_1.Message.getFieldWithDefault(this, 21, []) as string[]; + } + set tags(value: string[]) { + pb_1.Message.setField(this, 21, value); + } + static fromObject(data: { + type?: string; + name?: string; + description?: string; + version?: string; + application?: string; + url?: string; + meta?: string; + tags?: string[]; + }): WebAppDeploymentRecord { + const message = new WebAppDeploymentRecord({}); + if (data.type != null) { + message.type = data.type; + } + if (data.name != null) { + message.name = data.name; + } + if (data.description != null) { + message.description = data.description; + } + if (data.version != null) { + message.version = data.version; + } + if (data.application != null) { + message.application = data.application; + } + if (data.url != null) { + message.url = data.url; + } + if (data.meta != null) { + message.meta = data.meta; + } + if (data.tags != null) { + message.tags = data.tags; + } + return message; + } + toObject() { + const data: { + type?: string; + name?: string; + description?: string; + version?: string; + application?: string; + url?: string; + meta?: string; + tags?: string[]; + } = {}; + if (this.type != null) { + data.type = this.type; + } + if (this.name != null) { + data.name = this.name; + } + if (this.description != null) { + data.description = this.description; + } + if (this.version != null) { + data.version = this.version; + } + if (this.application != null) { + data.application = this.application; + } + if (this.url != null) { + data.url = this.url; + } + if (this.meta != null) { + data.meta = this.meta; + } + if (this.tags != null) { + data.tags = this.tags; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.type.length) + writer.writeString(1, this.type); + if (this.name.length) + writer.writeString(2, this.name); + if (this.description.length) + writer.writeString(3, this.description); + if (this.version.length) + writer.writeString(4, this.version); + if (this.application.length) + writer.writeString(5, this.application); + if (this.url.length) + writer.writeString(6, this.url); + if (this.meta.length) + writer.writeString(20, this.meta); + if (this.tags.length) + writer.writeRepeatedString(21, this.tags); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WebAppDeploymentRecord { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WebAppDeploymentRecord(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type = reader.readString(); + break; + case 2: + message.name = reader.readString(); + break; + case 3: + message.description = reader.readString(); + break; + case 4: + message.version = reader.readString(); + break; + case 5: + message.application = reader.readString(); + break; + case 6: + message.url = reader.readString(); + break; + case 20: + message.meta = reader.readString(); + break; + case 21: + pb_1.Message.addToRepeatedField(message, 21, reader.readString()); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WebAppDeploymentRecord { + return WebAppDeploymentRecord.deserialize(bytes); + } + } + export class GeneralRecord extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + type?: string; + name?: string; + description?: string; + version?: string; + category?: string; + value?: string; + meta?: string; + tags?: string[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [21], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("name" in data && data.name != undefined) { + this.name = data.name; + } + if ("description" in data && data.description != undefined) { + this.description = data.description; + } + if ("version" in data && data.version != undefined) { + this.version = data.version; + } + if ("category" in data && data.category != undefined) { + this.category = data.category; + } + if ("value" in data && data.value != undefined) { + this.value = data.value; + } + if ("meta" in data && data.meta != undefined) { + this.meta = data.meta; + } + if ("tags" in data && data.tags != undefined) { + this.tags = data.tags; + } + } + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set type(value: string) { + pb_1.Message.setField(this, 1, value); + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set name(value: string) { + pb_1.Message.setField(this, 2, value); + } + get description() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set description(value: string) { + pb_1.Message.setField(this, 3, value); + } + get version() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set version(value: string) { + pb_1.Message.setField(this, 4, value); + } + get category() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set category(value: string) { + pb_1.Message.setField(this, 5, value); + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set value(value: string) { + pb_1.Message.setField(this, 6, value); + } + get meta() { + return pb_1.Message.getFieldWithDefault(this, 20, "") as string; + } + set meta(value: string) { + pb_1.Message.setField(this, 20, value); + } + get tags() { + return pb_1.Message.getFieldWithDefault(this, 21, []) as string[]; + } + set tags(value: string[]) { + pb_1.Message.setField(this, 21, value); + } + static fromObject(data: { + type?: string; + name?: string; + description?: string; + version?: string; + category?: string; + value?: string; + meta?: string; + tags?: string[]; + }): GeneralRecord { + const message = new GeneralRecord({}); + if (data.type != null) { + message.type = data.type; + } + if (data.name != null) { + message.name = data.name; + } + if (data.description != null) { + message.description = data.description; + } + if (data.version != null) { + message.version = data.version; + } + if (data.category != null) { + message.category = data.category; + } + if (data.value != null) { + message.value = data.value; + } + if (data.meta != null) { + message.meta = data.meta; + } + if (data.tags != null) { + message.tags = data.tags; + } + return message; + } + toObject() { + const data: { + type?: string; + name?: string; + description?: string; + version?: string; + category?: string; + value?: string; + meta?: string; + tags?: string[]; + } = {}; + if (this.type != null) { + data.type = this.type; + } + if (this.name != null) { + data.name = this.name; + } + if (this.description != null) { + data.description = this.description; + } + if (this.version != null) { + data.version = this.version; + } + if (this.category != null) { + data.category = this.category; + } + if (this.value != null) { + data.value = this.value; + } + if (this.meta != null) { + data.meta = this.meta; + } + if (this.tags != null) { + data.tags = this.tags; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.type.length) + writer.writeString(1, this.type); + if (this.name.length) + writer.writeString(2, this.name); + if (this.description.length) + writer.writeString(3, this.description); + if (this.version.length) + writer.writeString(4, this.version); + if (this.category.length) + writer.writeString(5, this.category); + if (this.value.length) + writer.writeString(6, this.value); + if (this.meta.length) + writer.writeString(20, this.meta); + if (this.tags.length) + writer.writeRepeatedString(21, this.tags); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GeneralRecord { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GeneralRecord(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type = reader.readString(); + break; + case 2: + message.name = reader.readString(); + break; + case 3: + message.description = reader.readString(); + break; + case 4: + message.version = reader.readString(); + break; + case 5: + message.category = reader.readString(); + break; + case 6: + message.value = reader.readString(); + break; + case 20: + message.meta = reader.readString(); + break; + case 21: + pb_1.Message.addToRepeatedField(message, 21, reader.readString()); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GeneralRecord { + return GeneralRecord.deserialize(bytes); + } + } } diff --git a/src/proto/vulcanize/registry/v1beta1/genesis.ts b/src/proto/vulcanize/registry/v1beta1/genesis.ts index 0a12e8a..561ccdc 100644 --- a/src/proto/vulcanize/registry/v1beta1/genesis.ts +++ b/src/proto/vulcanize/registry/v1beta1/genesis.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/registry/v1beta1/genesis.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/proto/vulcanize/registry/v1beta1/query.ts b/src/proto/vulcanize/registry/v1beta1/query.ts index ab26f6f..28a36e3 100644 --- a/src/proto/vulcanize/registry/v1beta1/query.ts +++ b/src/proto/vulcanize/registry/v1beta1/query.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/registry/v1beta1/query.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./registry"; diff --git a/src/proto/vulcanize/registry/v1beta1/registry.ts b/src/proto/vulcanize/registry/v1beta1/registry.ts index 194f1e1..e7b4e22 100644 --- a/src/proto/vulcanize/registry/v1beta1/registry.ts +++ b/src/proto/vulcanize/registry/v1beta1/registry.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/registry/v1beta1/registry.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../google/protobuf/duration"; diff --git a/src/proto/vulcanize/registry/v1beta1/tx.ts b/src/proto/vulcanize/registry/v1beta1/tx.ts index 56f4f2f..bf577ce 100644 --- a/src/proto/vulcanize/registry/v1beta1/tx.ts +++ b/src/proto/vulcanize/registry/v1beta1/tx.ts @@ -2,7 +2,7 @@ /* eslint-disable */ /** * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 3.12.4 + * compiler version: 4.25.1 * source: vulcanize/registry/v1beta1/tx.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./../../../gogoproto/gogo"; diff --git a/src/types.ts b/src/types.ts index 49d687a..b64c192 100644 --- a/src/types.ts +++ b/src/types.ts @@ -29,17 +29,22 @@ export class Record { } get attributes() { + let a = new any.google.protobuf.Any(); - var a = new any.google.protobuf.Any() + if (this._record.type) { + const namespace: any = attributes.vulcanize.registry.v1beta1; + if (!namespace[this._record.type]) { + throw new Error(`Class not found: ${this._record.type}`); + } - if (this._record.type=="WebsiteRegistrationRecord"){ - var attr= new attributes.vulcanize.registry.v1beta1.WebsiteRegistrationRecord(this._record) - a= new any.google.protobuf.Any({ - type_url: "/vulcanize.registry.v1beta1.WebsiteRegistrationRecord", - value: attr.serialize() - }) + const value = namespace[this._record.type].fromObject(this._record); + a = new any.google.protobuf.Any({ + type_url: `/vulcanize.registry.v1beta1.${this._record.type}`, + value: value.serialize(), + }); } - return a + + return a; } /** diff --git a/yarn.lock b/yarn.lock index cf121c4..dd084e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3086,10 +3086,10 @@ protobufjs@~6.11.2: "@types/node" ">=13.7.0" long "^4.0.0" -protoc-gen-ts@^0.8.5: - version "0.8.5" - resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.5.tgz#5c277ff90b6b38f52313b1b0ad69e6c825305b29" - integrity sha512-LHZ+w/+DqmdgnhPtShgqtPtdv+hJ9bAXEIqNU0kkY2bPcCVIEWz5seOv20FCw6gbKorriTGP8xgz2RsIcrRvVw== +protoc-gen-ts@^0.8.7: + version "0.8.7" + resolved "https://registry.yarnpkg.com/protoc-gen-ts/-/protoc-gen-ts-0.8.7.tgz#63e4d9af2ad30b753acf6f739323d01fc9f80b52" + integrity sha512-jr4VJey2J9LVYCV7EVyVe53g1VMw28cCmYJhBe5e3YX5wiyiDwgxWxeDf9oTqAe4P1bN/YGAkW2jhlH8LohwiQ== randombytes@^2.0.1, randombytes@^2.1.0: version "2.1.0"