remove hard-coded record types
This commit is contained in:
parent
8e65f0db20
commit
559461b2c9
@ -1,131 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package vulcanize.registry.v1beta1;
|
|
||||||
|
|
||||||
import "gogoproto/gogo.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
|
||||||
|
|
||||||
message ServiceProviderRegistration {
|
|
||||||
string bond_id = 1 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
|
||||||
string laconic_id = 2 [(gogoproto.moretags) = "json:\"laconicId\" yaml:\"laconicId\""];
|
|
||||||
X500 x500 = 3 [(gogoproto.moretags) = "json:\"x500\" yaml:\"x500\""];
|
|
||||||
string type = 4 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message X500 {
|
|
||||||
string common_name = 1 [(gogoproto.moretags) = "json:\"commonName\" yaml:\"commonName\""];
|
|
||||||
string organization_unit = 2 [(gogoproto.moretags) = "json:\"organizationUnit\" yaml:\"organizationUnit\""];
|
|
||||||
string organization_name = 3 [(gogoproto.moretags) = "json:\"organizationName\" yaml:\"organizationName\""];
|
|
||||||
string locality_name = 4 [(gogoproto.moretags) = "json:\"localityName\" yaml:\"localityName\""];
|
|
||||||
string state_name = 5 [(gogoproto.moretags) = "json:\"stateName\" yaml:\"stateName\""];
|
|
||||||
string country = 6 [(gogoproto.moretags) = "json:\"country\" yaml:\"country\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message WebsiteRegistrationRecord {
|
|
||||||
string url = 1 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
|
|
||||||
string repo_registration_record_cid = 2
|
|
||||||
[(gogoproto.moretags) = "json:\"repoRegistrationRecordCID\" yaml:\"repoRegistrationRecordCID\""];
|
|
||||||
string build_artifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""];
|
|
||||||
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\""];
|
|
||||||
repeated string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
|
|
||||||
string repository_ref = 9 [(gogoproto.moretags) = "json:\"repositoryRef\" yaml:\"repositoryRef\""];
|
|
||||||
string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
|
|
||||||
string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
|
|
||||||
string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""];
|
|
||||||
repeated string os = 13 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
|
|
||||||
repeated string cpu = 14 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationArtifact {
|
|
||||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
|
||||||
string description = 4 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
|
||||||
string version = 5 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
string application = 6 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
|
||||||
string content_type = 7 [(gogoproto.moretags) = "json:\"contentType\" yaml:\"contentType\""];
|
|
||||||
string os = 8 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
|
|
||||||
string cpu = 9 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
|
|
||||||
repeated string uri = 10 [(gogoproto.moretags) = "json:\"uri\" yaml:\"uri\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message DnsRecord {
|
|
||||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
|
||||||
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
string resource_type = 4 [(gogoproto.moretags) = "json:\"resourceType\" yaml:\"resourceType\""];
|
|
||||||
string value = 5 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
|
|
||||||
string request = 6 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationDeploymentRequest {
|
|
||||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
|
||||||
string version = 3 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
string application = 4 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
|
||||||
string dns = 5 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
|
|
||||||
string config = 6 [(gogoproto.moretags) = "json:\"config\" yaml:\"config\""];
|
|
||||||
string deployment = 7 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationDeploymentRecord {
|
|
||||||
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:\"url\" yaml:\"url\""];
|
|
||||||
string dns = 7 [(gogoproto.moretags) = "json:\"dns\" yaml:\"dns\""];
|
|
||||||
string request = 8 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationDeploymentRemovalRequest {
|
|
||||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
|
||||||
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
|
||||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
|
||||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ApplicationDeploymentRemovalRecord {
|
|
||||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
|
||||||
string version = 2 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
|
||||||
string deployment = 3 [(gogoproto.moretags) = "json:\"deployment\" yaml:\"deployment\""];
|
|
||||||
string request = 4 [(gogoproto.moretags) = "json:\"request\" yaml:\"request\""];
|
|
||||||
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\""];
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import "google/protobuf/duration.proto";
|
|||||||
import "google/protobuf/timestamp.proto";
|
import "google/protobuf/timestamp.proto";
|
||||||
import "gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
import "cosmos/base/v1beta1/coin.proto";
|
import "cosmos/base/v1beta1/coin.proto";
|
||||||
import "google/protobuf/any.proto";
|
|
||||||
|
|
||||||
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
option go_package = "github.com/cerc-io/laconicd/x/registry/types";
|
||||||
|
|
||||||
@ -58,15 +57,15 @@ message Params {
|
|||||||
|
|
||||||
// Params defines the registry module records
|
// Params defines the registry module records
|
||||||
message Record {
|
message Record {
|
||||||
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
string id = 1 [(gogoproto.moretags) = "json:\"id\" yaml:\"id\""];
|
||||||
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
string bond_id = 2 [(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""];
|
||||||
string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""];
|
string create_time = 3 [(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""];
|
||||||
string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""];
|
string expiry_time = 4 [(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""];
|
||||||
bool deleted = 5;
|
bool deleted = 5;
|
||||||
repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""];
|
repeated string owners = 6 [(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""];
|
||||||
google.protobuf.Any attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""];
|
bytes attributes = 7 [(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""];
|
||||||
repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
repeated string names = 8 [(gogoproto.moretags) = "json:\"names\" yaml:\"names\""];
|
||||||
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
string type = 9 [(gogoproto.moretags) = "json:\"types\" yaml:\"types\""];
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuthorityEntry defines the registry module AuthorityEntries
|
// AuthorityEntry defines the registry module AuthorityEntries
|
||||||
|
@ -6,7 +6,7 @@ DEST_TS=$(pwd)/src/proto/
|
|||||||
mkdir -p $DEST_TS
|
mkdir -p $DEST_TS
|
||||||
|
|
||||||
protoc \
|
protoc \
|
||||||
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
|
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
|
||||||
--ts_out=$DEST_TS \
|
--ts_out=$DEST_TS \
|
||||||
--proto_path=$I \
|
--proto_path=$I \
|
||||||
$(find $(pwd)/proto/vulcanize -iname "*.proto")
|
$(find $(pwd)/proto/vulcanize -iname "*.proto")
|
||||||
|
@ -166,10 +166,6 @@ export class Account {
|
|||||||
assert(message);
|
assert(message);
|
||||||
const eipMessageDomain: any = message.eipToSign.domain;
|
const eipMessageDomain: any = message.eipToSign.domain;
|
||||||
|
|
||||||
if(message.eipToSign.message.msgs[0].value.payload!=null){
|
|
||||||
message.eipToSign.message.msgs[0].value.payload.record.attributes.value=Array.from(message.eipToSign.message.msgs[0].value.payload.record.attributes.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
const signature = signTypedData({
|
const signature = signTypedData({
|
||||||
data: {
|
data: {
|
||||||
types: message.eipToSign.types as MessageTypes,
|
types: message.eipToSign.types as MessageTypes,
|
||||||
|
@ -44,11 +44,7 @@ const MSG_SET_RECORD_TYPES = {
|
|||||||
{ name: 'create_time', type: 'string' },
|
{ name: 'create_time', type: 'string' },
|
||||||
{ name: 'expiry_time', type: 'string' },
|
{ name: 'expiry_time', type: 'string' },
|
||||||
{ name: 'deleted', type: 'bool' },
|
{ name: 'deleted', type: 'bool' },
|
||||||
{ name: 'attributes', type: 'TypePayloadRecordAttributes' },
|
{ name: 'attributes', type: 'bytes' },
|
||||||
],
|
|
||||||
TypePayloadRecordAttributes: [
|
|
||||||
{ name: 'type_url', type: 'string' },
|
|
||||||
{ name: 'value', type: 'uint8[]' },
|
|
||||||
],
|
],
|
||||||
TypePayloadSignatures: [
|
TypePayloadSignatures: [
|
||||||
{ name: 'sig', type: 'string' },
|
{ name: 'sig', type: 'string' },
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
|
||||||
* 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";
|
|
||||||
import * as pb_1 from "google-protobuf";
|
|
||||||
export namespace google.protobuf {
|
|
||||||
export class Any extends pb_1.Message {
|
|
||||||
#one_of_decls: number[][] = [];
|
|
||||||
constructor(data?: any[] | {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
}) {
|
|
||||||
super();
|
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
|
||||||
if ("type_url" in data && data.type_url != undefined) {
|
|
||||||
this.type_url = data.type_url;
|
|
||||||
}
|
|
||||||
if ("value" in data && data.value != undefined) {
|
|
||||||
this.value = data.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get type_url() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
|
||||||
}
|
|
||||||
set type_url(value: string) {
|
|
||||||
pb_1.Message.setField(this, 1, value);
|
|
||||||
}
|
|
||||||
get value() {
|
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
|
|
||||||
}
|
|
||||||
set value(value: Uint8Array) {
|
|
||||||
pb_1.Message.setField(this, 2, value);
|
|
||||||
}
|
|
||||||
static fromObject(data: {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
}): Any {
|
|
||||||
const message = new Any({});
|
|
||||||
if (data.type_url != null) {
|
|
||||||
message.type_url = data.type_url;
|
|
||||||
}
|
|
||||||
if (data.value != null) {
|
|
||||||
message.value = data.value;
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
toObject() {
|
|
||||||
const data: {
|
|
||||||
type_url?: string;
|
|
||||||
value?: Uint8Array;
|
|
||||||
} = {};
|
|
||||||
if (this.type_url != null) {
|
|
||||||
data.type_url = this.type_url;
|
|
||||||
}
|
|
||||||
if (this.value != null) {
|
|
||||||
data.value = this.value;
|
|
||||||
}
|
|
||||||
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_url.length)
|
|
||||||
writer.writeString(1, this.type_url);
|
|
||||||
if (this.value.length)
|
|
||||||
writer.writeBytes(2, this.value);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Any {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Any();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.type_url = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.value = reader.readBytes();
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Any {
|
|
||||||
return Any.deserialize(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,6 @@ import * as dependency_1 from "./../../../google/protobuf/duration";
|
|||||||
import * as dependency_2 from "./../../../google/protobuf/timestamp";
|
import * as dependency_2 from "./../../../google/protobuf/timestamp";
|
||||||
import * as dependency_3 from "./../../../gogoproto/gogo";
|
import * as dependency_3 from "./../../../gogoproto/gogo";
|
||||||
import * as dependency_4 from "./../../../cosmos/base/v1beta1/coin";
|
import * as dependency_4 from "./../../../cosmos/base/v1beta1/coin";
|
||||||
import * as dependency_5 from "./../../../google/protobuf/any";
|
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from "google-protobuf";
|
||||||
export namespace vulcanize.registry.v1beta1 {
|
export namespace vulcanize.registry.v1beta1 {
|
||||||
export class Params extends pb_1.Message {
|
export class Params extends pb_1.Message {
|
||||||
@ -348,7 +347,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: dependency_5.google.protobuf.Any;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
}) {
|
}) {
|
||||||
@ -421,13 +420,10 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
pb_1.Message.setField(this, 6, value);
|
pb_1.Message.setField(this, 6, value);
|
||||||
}
|
}
|
||||||
get attributes() {
|
get attributes() {
|
||||||
return pb_1.Message.getWrapperField(this, dependency_5.google.protobuf.Any, 7) as dependency_5.google.protobuf.Any;
|
return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array;
|
||||||
}
|
}
|
||||||
set attributes(value: dependency_5.google.protobuf.Any) {
|
set attributes(value: Uint8Array) {
|
||||||
pb_1.Message.setWrapperField(this, 7, value);
|
pb_1.Message.setField(this, 7, value);
|
||||||
}
|
|
||||||
get has_attributes() {
|
|
||||||
return pb_1.Message.getField(this, 7) != null;
|
|
||||||
}
|
}
|
||||||
get names() {
|
get names() {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 8, []) as string[];
|
return pb_1.Message.getFieldWithDefault(this, 8, []) as string[];
|
||||||
@ -448,7 +444,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: ReturnType<typeof dependency_5.google.protobuf.Any.prototype.toObject>;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
}): Record {
|
}): Record {
|
||||||
@ -472,7 +468,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
message.owners = data.owners;
|
message.owners = data.owners;
|
||||||
}
|
}
|
||||||
if (data.attributes != null) {
|
if (data.attributes != null) {
|
||||||
message.attributes = dependency_5.google.protobuf.Any.fromObject(data.attributes);
|
message.attributes = data.attributes;
|
||||||
}
|
}
|
||||||
if (data.names != null) {
|
if (data.names != null) {
|
||||||
message.names = data.names;
|
message.names = data.names;
|
||||||
@ -490,7 +486,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
expiry_time?: string;
|
expiry_time?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
owners?: string[];
|
owners?: string[];
|
||||||
attributes?: ReturnType<typeof dependency_5.google.protobuf.Any.prototype.toObject>;
|
attributes?: Uint8Array;
|
||||||
names?: string[];
|
names?: string[];
|
||||||
type?: string;
|
type?: string;
|
||||||
} = {};
|
} = {};
|
||||||
@ -513,7 +509,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
data.owners = this.owners;
|
data.owners = this.owners;
|
||||||
}
|
}
|
||||||
if (this.attributes != null) {
|
if (this.attributes != null) {
|
||||||
data.attributes = this.attributes.toObject();
|
data.attributes = this.attributes;
|
||||||
}
|
}
|
||||||
if (this.names != null) {
|
if (this.names != null) {
|
||||||
data.names = this.names;
|
data.names = this.names;
|
||||||
@ -539,8 +535,8 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
writer.writeBool(5, this.deleted);
|
writer.writeBool(5, this.deleted);
|
||||||
if (this.owners.length)
|
if (this.owners.length)
|
||||||
writer.writeRepeatedString(6, this.owners);
|
writer.writeRepeatedString(6, this.owners);
|
||||||
if (this.has_attributes)
|
if (this.attributes.length)
|
||||||
writer.writeMessage(7, this.attributes, () => this.attributes.serialize(writer));
|
writer.writeBytes(7, this.attributes);
|
||||||
if (this.names.length)
|
if (this.names.length)
|
||||||
writer.writeRepeatedString(8, this.names);
|
writer.writeRepeatedString(8, this.names);
|
||||||
if (this.type.length)
|
if (this.type.length)
|
||||||
@ -573,7 +569,7 @@ export namespace vulcanize.registry.v1beta1 {
|
|||||||
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
pb_1.Message.addToRepeatedField(message, 6, reader.readString());
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
reader.readMessage(message.attributes, () => message.attributes = dependency_5.google.protobuf.Any.deserialize(reader));
|
message.attributes = reader.readBytes();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
pb_1.Message.addToRepeatedField(message, 8, reader.readString());
|
pb_1.Message.addToRepeatedField(message, 8, reader.readString());
|
||||||
|
19
src/types.ts
19
src/types.ts
@ -3,8 +3,6 @@ import { Validator } from 'jsonschema';
|
|||||||
|
|
||||||
import RecordSchema from './schema/record.json';
|
import RecordSchema from './schema/record.json';
|
||||||
import { Util } from './util';
|
import { Util } from './util';
|
||||||
import * as attributes from './proto/vulcanize/registry/v1beta1/attributes';
|
|
||||||
import * as any from './proto/google/protobuf/any';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record.
|
* Record.
|
||||||
@ -29,22 +27,7 @@ export class Record {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get attributes() {
|
get attributes() {
|
||||||
let a = new any.google.protobuf.Any();
|
return Buffer.from(JSON.stringify(this._record), 'binary')
|
||||||
|
|
||||||
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}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user