Replace wrn with crn

This commit is contained in:
nabarun 2022-04-20 13:08:57 +05:30 committed by Ashwin Phatak
parent e563cfe6b1
commit 79b55b73da
12 changed files with 600 additions and 147 deletions

View File

@ -12,13 +12,13 @@ Run following scripts when [proto files](./proto/) are updated.
2. Generate typescript code for the proto files
```bash
./create-proto-files.sh
./scripts/create-proto-files.sh
```
3. Remove GRPC code from generated code
```bash
./remove-grpc.sh
./scripts/remove-grpc.sh
```
Reference: https://github.com/tharsis/evmosjs/tree/main/packages/proto#note

View File

@ -81,6 +81,9 @@ message Record {
string attributes = 7 [
(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""
];
repeated string names = 8 [
(gogoproto.moretags) = "json:\"names\" yaml:\"names\""
];
}
// AuthorityEntry defines the nameservice module AuthorityEntries

View File

@ -39,12 +39,12 @@ service Query {
rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/whois/{name}";
}
// LookupWrn
rpc LookupWrn(QueryLookupWrn) returns (QueryLookupWrnResponse){
// LookupCrn
rpc LookupCrn(QueryLookupCrn) returns (QueryLookupCrnResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/lookup";
}
// ResolveWrn
rpc ResolveWrn(QueryResolveWrn) returns (QueryResolveWrnResponse){
// ResolveCrn
rpc ResolveCrn(QueryResolveCrn) returns (QueryResolveCrnResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/resolve";
}
// GetRecordExpiryQueue
@ -68,8 +68,28 @@ message QueryParamsResponse{
// QueryListRecordsRequest is request type for nameservice records list
message QueryListRecordsRequest{
message ReferenceInput {
string id = 1;
}
message ValueInput {
string type = 1;
string string = 2;
int64 int = 3;
double float = 4;
bool boolean = 5;
ReferenceInput reference = 6;
repeated ValueInput values = 7;
}
message KeyValueInput {
string key = 1;
ValueInput value = 2;
}
repeated KeyValueInput attributes = 1;
bool all = 2;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
// QueryListRecordsResponse is response type for nameservice records list
@ -158,23 +178,23 @@ message QueryWhoisResponse{
];
}
// QueryLookupWrn is request type for LookupWrn
message QueryLookupWrn{
string wrn = 1;
// QueryLookupCrn is request type for LookupCrn
message QueryLookupCrn{
string crn = 1;
}
// QueryLookupWrnResponse is response type for QueryLookupWrn
message QueryLookupWrnResponse{
// QueryLookupCrnResponse is response type for QueryLookupCrn
message QueryLookupCrnResponse{
NameRecord name = 1;
}
// QueryResolveWrn is request type for ResolveWrn
message QueryResolveWrn{
string wrn = 1;
// QueryResolveCrn is request type for ResolveCrn
message QueryResolveCrn{
string crn = 1;
}
// QueryResolveWrnResponse is response type for QueryResolveWrn
message QueryResolveWrnResponse{
// QueryResolveCrnResponse is response type for QueryResolveCrn
message QueryResolveCrnResponse{
Record record = 1;
}

View File

@ -20,7 +20,7 @@ service Msg {
rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse){}
// ReAssociateRecords
rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse){}
// SetName will store the name with given wrn and name
// SetName will store the name with given crn and name
rpc SetName(MsgSetName) returns (MsgSetNameResponse){}
// Reserve name
rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse){}
@ -56,7 +56,7 @@ message Payload {
// MsgSetName
message MsgSetName{
string wrn = 1;
string crn = 1;
string cid = 2;
string signer = 3;
}
@ -92,7 +92,7 @@ message MsgSetAuthorityBondResponse{
// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
message MsgDeleteNameAuthority{
string wrn = 1;
string crn = 1;
string signer = 2;
}

View File

@ -30,7 +30,7 @@ const auctionTests = (numBidders = 3) => {
});
test('Reserve authority.', async () => {
authorityName = `dxos-${Date.now()}`;
authorityName = `chiba-clonk-${Date.now()}`;
await registry.reserveAuthority({ name: authorityName }, accounts[0].privateKey, fee);
});

View File

@ -393,7 +393,7 @@ export class Registry {
}
/**
* Set name (WRN) to record ID (CID).
* Set name (CRN) to record ID (CID).
*/
async setName(params: MessageMsgSetName, privateKey: string, fee: Fee) {
let result;
@ -421,7 +421,7 @@ export class Registry {
}
/**
* Delete name (WRN) mapping.
* Delete name (CRN) mapping.
*/
async deleteName(params: MessageMsgDeleteName, privateKey: string, fee: Fee) {
let result;

View File

@ -22,7 +22,7 @@ const MSG_RESERVE_AUTHORITY_TYPES = {
const MSG_SET_NAME_TYPES = {
MsgValue: [
{ name: 'wrn', type: 'string' },
{ name: 'crn', type: 'string' },
{ name: 'cid', type: 'string' },
{ name: 'signer', type: 'string' },
],
@ -62,7 +62,7 @@ const MSG_SET_AUTHORITY_BOND_TYPES = {
const MSG_DELETE_NAME_TYPES = {
MsgValue: [
{ name: 'wrn', type: 'string' },
{ name: 'crn', type: 'string' },
{ name: 'signer', type: 'string' },
],
}
@ -80,7 +80,7 @@ export interface MessageMsgReserveAuthority {
}
export interface MessageMsgSetName {
wrn: string
crn: string
cid: string
}
@ -95,7 +95,7 @@ export interface MessageMsgSetAuthorityBond {
}
export interface MessageMsgDeleteName {
wrn: string
crn: string
}
export function createTxMsgReserveAuthority(
@ -132,13 +132,13 @@ export function createTxMsgSetName(
const types = generateTypes(MSG_SET_NAME_TYPES)
const msg = createMsgSetName(
params.wrn,
params.crn,
params.cid,
sender.accountAddress
)
const msgCosmos = protoCreateMsgSetName(
params.wrn,
params.crn,
params.cid,
sender.accountAddress
)
@ -204,12 +204,12 @@ export function createTxMsgDeleteName(
const types = generateTypes(MSG_DELETE_NAME_TYPES)
const msg = createMsgDeleteName(
params.wrn,
params.crn,
sender.accountAddress
)
const msgCosmos = protoCreateMsgDeleteName(
params.wrn,
params.crn,
sender.accountAddress
)
@ -249,14 +249,14 @@ const protoCreateMsgReserveAuthority = (
}
function createMsgSetName(
wrn: string,
crn: string,
cid: string,
signer: string
) {
return {
type: 'nameservice/SetName',
value: {
wrn,
crn,
cid,
signer
},
@ -264,12 +264,12 @@ function createMsgSetName(
}
const protoCreateMsgSetName = (
wrn: string,
crn: string,
cid: string,
signer: string
) => {
const setNameMessage = new nameserviceTx.vulcanize.nameservice.v1beta1.MsgSetName({
wrn,
crn,
cid,
signer,
})
@ -358,24 +358,24 @@ const protoCreateMsgSetAuthorityBond = (
}
function createMsgDeleteName(
wrn: string,
crn: string,
signer: string
) {
return {
type: 'nameservice/DeleteAuthority',
value: {
wrn,
crn,
signer
},
}
}
const protoCreateMsgDeleteName = (
wrn: string,
crn: string,
signer: string
) => {
const deleteNameAutorityMessage = new nameserviceTx.vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority({
wrn,
crn,
signer,
})

View File

@ -50,7 +50,7 @@ const nameserviceExpiryTests = () => {
})
test('Reserve authority and set bond', async () => {
authorityName = `dxos-${Date.now()}`;
authorityName = `chiba-clonk-${Date.now()}`;
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
await registry.setAuthorityBond({ name: authorityName, bondId }, privateKey, fee);
const [authority] = await registry.lookupAuthorities([authorityName]);

View File

@ -22,7 +22,7 @@ const namingTests = () => {
let otherAuthorityName: string;
let otherPrivateKey: string;
let wrn: string;
let crn: string;
beforeAll(async () => {
registry = new Registry(restEndpoint, gqlEndpoint, chainId);
@ -48,7 +48,7 @@ const namingTests = () => {
});
test('Reserve authority.', async () => {
authorityName = `dxos-${Date.now()}`;
authorityName = `chiba-clonk-${Date.now()}`;
await registry.reserveAuthority({ name: authorityName }, privateKey, fee);
});
@ -106,9 +106,9 @@ const namingTests = () => {
});
test('Set name for unbonded authority', async () => {
wrn = `wrn://${authorityName}/app/test`;
crn = `crn://${authorityName}/app/test`;
assert(watcherId)
await expect(registry.setName({ wrn, cid: watcherId }, privateKey, fee)).rejects.toThrow('Authority bond not found.');
await expect(registry.setName({ crn: crn, cid: watcherId }, privateKey, fee)).rejects.toThrow('Authority bond not found.');
});
test('Set authority bond', async () => {
@ -116,17 +116,17 @@ const namingTests = () => {
});
test('Set name', async () => {
wrn = `wrn://${authorityName}/app/test`;
await registry.setName({ wrn, cid: watcherId }, privateKey, fee);
crn = `crn://${authorityName}/app/test`;
await registry.setName({ crn: crn, cid: watcherId }, privateKey, fee);
// Query records should return it (some WRN points to it).
// Query records should return it (some CRN points to it).
const records = await registry.queryRecords({ type: 'watcher', version: watcher.record.version });
expect(records).toBeDefined();
expect(records).toHaveLength(1);
});
test('Lookup name', async () => {
const records = await registry.lookupNames([wrn]);
const records = await registry.lookupNames([crn]);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
@ -139,7 +139,7 @@ const namingTests = () => {
});
test('Resolve name', async () => {
const records = await registry.resolveNames([wrn]);
const records = await registry.resolveNames([crn]);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
@ -161,9 +161,9 @@ const namingTests = () => {
const [record] = await registry.queryRecords({ type: 'watcher', version: updatedWatcher.record.version }, true);
const updatedWatcherId = record.id;
await registry.setName({ wrn, cid: updatedWatcherId }, privateKey, fee);
await registry.setName({ crn: crn, cid: updatedWatcherId }, privateKey, fee);
const records = await registry.lookupNames([wrn], true);
const records = await registry.lookupNames([crn], true);
expect(records).toHaveLength(1);
const [{ latest, history }] = records;
@ -182,7 +182,7 @@ const namingTests = () => {
});
test('Set name without reserving authority', async () => {
await expect(registry.setName({ wrn: 'wrn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
await expect(registry.setName({ crn: 'crn://not-reserved/app/test', cid: watcherId }, privateKey, fee))
.rejects.toThrow('Name authority not found.');
});
@ -198,11 +198,11 @@ const namingTests = () => {
await registry.reserveAuthority({ name: otherAuthorityName }, otherPrivateKey, fee);
// Try setting name under other authority.
await expect(registry.setName({ wrn: `wrn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
await expect(registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, privateKey, fee)).rejects.toThrow('Access denied.');
});
test('Lookup non existing name', async () => {
const records = await registry.lookupNames(['wrn://not-reserved/app/test']);
const records = await registry.lookupNames(['crn://not-reserved/app/test']);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
const [record] = records;
@ -210,7 +210,7 @@ const namingTests = () => {
});
test('Resolve non existing name', async () => {
const records = await registry.resolveNames(['wrn://not-reserved/app/test']);
const records = await registry.resolveNames(['crn://not-reserved/app/test']);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
const [record] = records;
@ -218,9 +218,9 @@ const namingTests = () => {
});
test('Delete name', async () => {
await registry.deleteName({ wrn }, privateKey, fee);
await registry.deleteName({ crn: crn }, privateKey, fee);
let records = await registry.lookupNames([wrn], true);
let records = await registry.lookupNames([crn], true);
expect(records).toBeDefined();
expect(records).toHaveLength(1);
@ -230,7 +230,7 @@ const namingTests = () => {
expect(latest.id).toBe('');
expect(latest.height).toBeDefined();
// Query records should NOT return it (no WRN points to it).
// Query records should NOT return it (no CRN points to it).
records = await registry.queryRecords({ type: 'watcher', version: watcher.record.version });
expect(records).toBeDefined();
expect(records).toHaveLength(0);
@ -242,9 +242,9 @@ const namingTests = () => {
});
test('Delete already deleted name', async () => {
await registry.deleteName({ wrn }, privateKey, fee);
await registry.deleteName({ crn: crn }, privateKey, fee);
const records = await registry.lookupNames([wrn], true);
const records = await registry.lookupNames([crn], true);
expect(records).toBeDefined();
expect(records).toBeDefined();
expect(records).toHaveLength(1);
@ -260,10 +260,10 @@ const namingTests = () => {
const otherBondId = await registry.getNextBondId(otherPrivateKey);
await registry.createBond({ denom: 'aphoton', amount: '10000' }, otherPrivateKey, fee);
await registry.setAuthorityBond({ name: otherAuthorityName, bondId: otherBondId }, otherPrivateKey, fee);
await registry.setName({ wrn: `wrn://${otherAuthorityName}/app/test`, cid: watcherId }, otherPrivateKey, fee);
await registry.setName({ crn: `crn://${otherAuthorityName}/app/test`, cid: watcherId }, otherPrivateKey, fee);
// Try deleting name under other authority.
await expect(registry.deleteName({ wrn: `wrn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
await expect(registry.deleteName({ crn: `crn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
});
};

View File

@ -316,9 +316,10 @@ export namespace vulcanize.nameservice.v1beta1 {
deleted?: boolean;
owners?: string[];
attributes?: string;
names?: string[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6], []);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6, 8], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
@ -341,6 +342,9 @@ export namespace vulcanize.nameservice.v1beta1 {
if ("attributes" in data && data.attributes != undefined) {
this.attributes = data.attributes;
}
if ("names" in data && data.names != undefined) {
this.names = data.names;
}
}
}
get id() {
@ -385,6 +389,12 @@ export namespace vulcanize.nameservice.v1beta1 {
set attributes(value: string) {
pb_1.Message.setField(this, 7, value);
}
get names() {
return pb_1.Message.getField(this, 8) as string[];
}
set names(value: string[]) {
pb_1.Message.setField(this, 8, value);
}
static fromObject(data: {
id?: string;
bond_id?: string;
@ -393,6 +403,7 @@ export namespace vulcanize.nameservice.v1beta1 {
deleted?: boolean;
owners?: string[];
attributes?: string;
names?: string[];
}) {
const message = new Record({});
if (data.id != null) {
@ -416,6 +427,9 @@ export namespace vulcanize.nameservice.v1beta1 {
if (data.attributes != null) {
message.attributes = data.attributes;
}
if (data.names != null) {
message.names = data.names;
}
return message;
}
toObject() {
@ -427,6 +441,7 @@ export namespace vulcanize.nameservice.v1beta1 {
deleted?: boolean;
owners?: string[];
attributes?: string;
names?: string[];
} = {};
if (this.id != null) {
data.id = this.id;
@ -449,6 +464,9 @@ export namespace vulcanize.nameservice.v1beta1 {
if (this.attributes != null) {
data.attributes = this.attributes;
}
if (this.names != null) {
data.names = this.names;
}
return data;
}
serialize(): Uint8Array;
@ -469,6 +487,8 @@ export namespace vulcanize.nameservice.v1beta1 {
writer.writeRepeatedString(6, this.owners);
if (typeof this.attributes === "string" && this.attributes.length)
writer.writeString(7, this.attributes);
if (this.names !== undefined)
writer.writeRepeatedString(8, this.names);
if (!w)
return writer.getResultBuffer();
}
@ -499,6 +519,9 @@ export namespace vulcanize.nameservice.v1beta1 {
case 7:
message.attributes = reader.readString();
break;
case 8:
pb_1.Message.addToRepeatedField(message, 8, reader.readString());
break;
default: reader.skipField();
}
}

View File

@ -119,26 +119,54 @@ export namespace vulcanize.nameservice.v1beta1 {
}
export class QueryListRecordsRequest extends pb_1.Message {
constructor(data?: any[] | {
attributes?: QueryListRecordsRequest.KeyValueInput[];
all?: boolean;
pagination?: dependency_3.cosmos.base.query.v1beta1.PageRequest;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("attributes" in data && data.attributes != undefined) {
this.attributes = data.attributes;
}
if ("all" in data && data.all != undefined) {
this.all = data.all;
}
if ("pagination" in data && data.pagination != undefined) {
this.pagination = data.pagination;
}
}
}
get attributes() {
return pb_1.Message.getRepeatedWrapperField(this, QueryListRecordsRequest.KeyValueInput, 1) as QueryListRecordsRequest.KeyValueInput[];
}
set attributes(value: QueryListRecordsRequest.KeyValueInput[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get all() {
return pb_1.Message.getField(this, 2) as boolean;
}
set all(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
get pagination() {
return pb_1.Message.getWrapperField(this, dependency_3.cosmos.base.query.v1beta1.PageRequest, 1) as dependency_3.cosmos.base.query.v1beta1.PageRequest;
return pb_1.Message.getWrapperField(this, dependency_3.cosmos.base.query.v1beta1.PageRequest, 3) as dependency_3.cosmos.base.query.v1beta1.PageRequest;
}
set pagination(value: dependency_3.cosmos.base.query.v1beta1.PageRequest) {
pb_1.Message.setWrapperField(this, 1, value);
pb_1.Message.setWrapperField(this, 3, value);
}
static fromObject(data: {
attributes?: ReturnType<typeof QueryListRecordsRequest.KeyValueInput.prototype.toObject>[];
all?: boolean;
pagination?: ReturnType<typeof dependency_3.cosmos.base.query.v1beta1.PageRequest.prototype.toObject>;
}) {
const message = new QueryListRecordsRequest({});
if (data.attributes != null) {
message.attributes = data.attributes.map(item => QueryListRecordsRequest.KeyValueInput.fromObject(item));
}
if (data.all != null) {
message.all = data.all;
}
if (data.pagination != null) {
message.pagination = dependency_3.cosmos.base.query.v1beta1.PageRequest.fromObject(data.pagination);
}
@ -146,8 +174,16 @@ export namespace vulcanize.nameservice.v1beta1 {
}
toObject() {
const data: {
attributes?: ReturnType<typeof QueryListRecordsRequest.KeyValueInput.prototype.toObject>[];
all?: boolean;
pagination?: ReturnType<typeof dependency_3.cosmos.base.query.v1beta1.PageRequest.prototype.toObject>;
} = {};
if (this.attributes != null) {
data.attributes = this.attributes.map((item: QueryListRecordsRequest.KeyValueInput) => item.toObject());
}
if (this.all != null) {
data.all = this.all;
}
if (this.pagination != null) {
data.pagination = this.pagination.toObject();
}
@ -157,8 +193,12 @@ export namespace vulcanize.nameservice.v1beta1 {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.attributes !== undefined)
writer.writeRepeatedMessage(1, this.attributes, (item: QueryListRecordsRequest.KeyValueInput) => item.serialize(writer));
if (this.all !== undefined)
writer.writeBool(2, this.all);
if (this.pagination !== undefined)
writer.writeMessage(1, this.pagination, () => this.pagination.serialize(writer));
writer.writeMessage(3, this.pagination, () => this.pagination.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -169,6 +209,12 @@ export namespace vulcanize.nameservice.v1beta1 {
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.attributes, () => pb_1.Message.addToRepeatedWrapperField(message, 1, QueryListRecordsRequest.KeyValueInput.deserialize(reader), QueryListRecordsRequest.KeyValueInput));
break;
case 2:
message.all = reader.readBool();
break;
case 3:
reader.readMessage(message.pagination, () => message.pagination = dependency_3.cosmos.base.query.v1beta1.PageRequest.deserialize(reader));
break;
default: reader.skipField();
@ -183,6 +229,367 @@ export namespace vulcanize.nameservice.v1beta1 {
return QueryListRecordsRequest.deserialize(bytes);
}
}
export namespace QueryListRecordsRequest {
export class ReferenceInput extends pb_1.Message {
constructor(data?: any[] | {
id?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
}
}
get id() {
return pb_1.Message.getField(this, 1) as string;
}
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
id?: string;
}) {
const message = new ReferenceInput({});
if (data.id != null) {
message.id = data.id;
}
return message;
}
toObject() {
const data: {
id?: string;
} = {};
if (this.id != null) {
data.id = this.id;
}
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 (typeof this.id === "string" && this.id.length)
writer.writeString(1, this.id);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ReferenceInput {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ReferenceInput();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ReferenceInput {
return ReferenceInput.deserialize(bytes);
}
}
export class ValueInput extends pb_1.Message {
constructor(data?: any[] | {
type?: string;
string?: string;
int?: number;
float?: number;
boolean?: boolean;
reference?: QueryListRecordsRequest.ReferenceInput;
values?: QueryListRecordsRequest.ValueInput[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [7], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("string" in data && data.string != undefined) {
this.string = data.string;
}
if ("int" in data && data.int != undefined) {
this.int = data.int;
}
if ("float" in data && data.float != undefined) {
this.float = data.float;
}
if ("boolean" in data && data.boolean != undefined) {
this.boolean = data.boolean;
}
if ("reference" in data && data.reference != undefined) {
this.reference = data.reference;
}
if ("values" in data && data.values != undefined) {
this.values = data.values;
}
}
}
get type() {
return pb_1.Message.getField(this, 1) as string;
}
set type(value: string) {
pb_1.Message.setField(this, 1, value);
}
get string() {
return pb_1.Message.getField(this, 2) as string;
}
set string(value: string) {
pb_1.Message.setField(this, 2, value);
}
get int() {
return pb_1.Message.getField(this, 3) as number;
}
set int(value: number) {
pb_1.Message.setField(this, 3, value);
}
get float() {
return pb_1.Message.getField(this, 4) as number;
}
set float(value: number) {
pb_1.Message.setField(this, 4, value);
}
get boolean() {
return pb_1.Message.getField(this, 5) as boolean;
}
set boolean(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
get reference() {
return pb_1.Message.getWrapperField(this, QueryListRecordsRequest.ReferenceInput, 6) as QueryListRecordsRequest.ReferenceInput;
}
set reference(value: QueryListRecordsRequest.ReferenceInput) {
pb_1.Message.setWrapperField(this, 6, value);
}
get values() {
return pb_1.Message.getRepeatedWrapperField(this, QueryListRecordsRequest.ValueInput, 7) as QueryListRecordsRequest.ValueInput[];
}
set values(value: QueryListRecordsRequest.ValueInput[]) {
pb_1.Message.setRepeatedWrapperField(this, 7, value);
}
static fromObject(data: {
type?: string;
string?: string;
int?: number;
float?: number;
boolean?: boolean;
reference?: ReturnType<typeof QueryListRecordsRequest.ReferenceInput.prototype.toObject>;
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
}) {
const message = new ValueInput({});
if (data.type != null) {
message.type = data.type;
}
if (data.string != null) {
message.string = data.string;
}
if (data.int != null) {
message.int = data.int;
}
if (data.float != null) {
message.float = data.float;
}
if (data.boolean != null) {
message.boolean = data.boolean;
}
if (data.reference != null) {
message.reference = QueryListRecordsRequest.ReferenceInput.fromObject(data.reference);
}
if (data.values != null) {
message.values = data.values.map(item => QueryListRecordsRequest.ValueInput.fromObject(item));
}
return message;
}
toObject() {
const data: {
type?: string;
string?: string;
int?: number;
float?: number;
boolean?: boolean;
reference?: ReturnType<typeof QueryListRecordsRequest.ReferenceInput.prototype.toObject>;
values?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>[];
} = {};
if (this.type != null) {
data.type = this.type;
}
if (this.string != null) {
data.string = this.string;
}
if (this.int != null) {
data.int = this.int;
}
if (this.float != null) {
data.float = this.float;
}
if (this.boolean != null) {
data.boolean = this.boolean;
}
if (this.reference != null) {
data.reference = this.reference.toObject();
}
if (this.values != null) {
data.values = this.values.map((item: QueryListRecordsRequest.ValueInput) => item.toObject());
}
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 (typeof this.type === "string" && this.type.length)
writer.writeString(1, this.type);
if (typeof this.string === "string" && this.string.length)
writer.writeString(2, this.string);
if (this.int !== undefined)
writer.writeInt64(3, this.int);
if (this.float !== undefined)
writer.writeDouble(4, this.float);
if (this.boolean !== undefined)
writer.writeBool(5, this.boolean);
if (this.reference !== undefined)
writer.writeMessage(6, this.reference, () => this.reference.serialize(writer));
if (this.values !== undefined)
writer.writeRepeatedMessage(7, this.values, (item: QueryListRecordsRequest.ValueInput) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ValueInput {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ValueInput();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.type = reader.readString();
break;
case 2:
message.string = reader.readString();
break;
case 3:
message.int = reader.readInt64();
break;
case 4:
message.float = reader.readDouble();
break;
case 5:
message.boolean = reader.readBool();
break;
case 6:
reader.readMessage(message.reference, () => message.reference = QueryListRecordsRequest.ReferenceInput.deserialize(reader));
break;
case 7:
reader.readMessage(message.values, () => pb_1.Message.addToRepeatedWrapperField(message, 7, QueryListRecordsRequest.ValueInput.deserialize(reader), QueryListRecordsRequest.ValueInput));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ValueInput {
return ValueInput.deserialize(bytes);
}
}
export class KeyValueInput extends pb_1.Message {
constructor(data?: any[] | {
key?: string;
value?: QueryListRecordsRequest.ValueInput;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("key" in data && data.key != undefined) {
this.key = data.key;
}
if ("value" in data && data.value != undefined) {
this.value = data.value;
}
}
}
get key() {
return pb_1.Message.getField(this, 1) as string;
}
set key(value: string) {
pb_1.Message.setField(this, 1, value);
}
get value() {
return pb_1.Message.getWrapperField(this, QueryListRecordsRequest.ValueInput, 2) as QueryListRecordsRequest.ValueInput;
}
set value(value: QueryListRecordsRequest.ValueInput) {
pb_1.Message.setWrapperField(this, 2, value);
}
static fromObject(data: {
key?: string;
value?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>;
}) {
const message = new KeyValueInput({});
if (data.key != null) {
message.key = data.key;
}
if (data.value != null) {
message.value = QueryListRecordsRequest.ValueInput.fromObject(data.value);
}
return message;
}
toObject() {
const data: {
key?: string;
value?: ReturnType<typeof QueryListRecordsRequest.ValueInput.prototype.toObject>;
} = {};
if (this.key != null) {
data.key = this.key;
}
if (this.value != null) {
data.value = this.value.toObject();
}
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 (typeof this.key === "string" && this.key.length)
writer.writeString(1, this.key);
if (this.value !== undefined)
writer.writeMessage(2, this.value, () => this.value.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): KeyValueInput {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new KeyValueInput();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.key = reader.readString();
break;
case 2:
reader.readMessage(message.value, () => message.value = QueryListRecordsRequest.ValueInput.deserialize(reader));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): KeyValueInput {
return KeyValueInput.deserialize(bytes);
}
}
}
export class QueryListRecordsResponse extends pb_1.Message {
constructor(data?: any[] | {
records?: dependency_1.vulcanize.nameservice.v1beta1.Record[];
@ -1063,39 +1470,39 @@ export namespace vulcanize.nameservice.v1beta1 {
return QueryWhoisResponse.deserialize(bytes);
}
}
export class QueryLookupWrn extends pb_1.Message {
export class QueryLookupCrn extends pb_1.Message {
constructor(data?: any[] | {
wrn?: string;
crn?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("wrn" in data && data.wrn != undefined) {
this.wrn = data.wrn;
if ("crn" in data && data.crn != undefined) {
this.crn = data.crn;
}
}
}
get wrn() {
get crn() {
return pb_1.Message.getField(this, 1) as string;
}
set wrn(value: string) {
set crn(value: string) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
wrn?: string;
crn?: string;
}) {
const message = new QueryLookupWrn({});
if (data.wrn != null) {
message.wrn = data.wrn;
const message = new QueryLookupCrn({});
if (data.crn != null) {
message.crn = data.crn;
}
return message;
}
toObject() {
const data: {
wrn?: string;
crn?: string;
} = {};
if (this.wrn != null) {
data.wrn = this.wrn;
if (this.crn != null) {
data.crn = this.crn;
}
return data;
}
@ -1103,19 +1510,19 @@ export namespace vulcanize.nameservice.v1beta1 {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (typeof this.wrn === "string" && this.wrn.length)
writer.writeString(1, this.wrn);
if (typeof this.crn === "string" && this.crn.length)
writer.writeString(1, this.crn);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryLookupWrn {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryLookupWrn();
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryLookupCrn {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryLookupCrn();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.wrn = reader.readString();
message.crn = reader.readString();
break;
default: reader.skipField();
}
@ -1125,11 +1532,11 @@ export namespace vulcanize.nameservice.v1beta1 {
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QueryLookupWrn {
return QueryLookupWrn.deserialize(bytes);
static deserializeBinary(bytes: Uint8Array): QueryLookupCrn {
return QueryLookupCrn.deserialize(bytes);
}
}
export class QueryLookupWrnResponse extends pb_1.Message {
export class QueryLookupCrnResponse extends pb_1.Message {
constructor(data?: any[] | {
name?: dependency_1.vulcanize.nameservice.v1beta1.NameRecord;
}) {
@ -1150,7 +1557,7 @@ export namespace vulcanize.nameservice.v1beta1 {
static fromObject(data: {
name?: ReturnType<typeof dependency_1.vulcanize.nameservice.v1beta1.NameRecord.prototype.toObject>;
}) {
const message = new QueryLookupWrnResponse({});
const message = new QueryLookupCrnResponse({});
if (data.name != null) {
message.name = dependency_1.vulcanize.nameservice.v1beta1.NameRecord.fromObject(data.name);
}
@ -1174,8 +1581,8 @@ export namespace vulcanize.nameservice.v1beta1 {
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryLookupWrnResponse {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryLookupWrnResponse();
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryLookupCrnResponse {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryLookupCrnResponse();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
@ -1191,43 +1598,43 @@ export namespace vulcanize.nameservice.v1beta1 {
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QueryLookupWrnResponse {
return QueryLookupWrnResponse.deserialize(bytes);
static deserializeBinary(bytes: Uint8Array): QueryLookupCrnResponse {
return QueryLookupCrnResponse.deserialize(bytes);
}
}
export class QueryResolveWrn extends pb_1.Message {
export class QueryResolveCrn extends pb_1.Message {
constructor(data?: any[] | {
wrn?: string;
crn?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("wrn" in data && data.wrn != undefined) {
this.wrn = data.wrn;
if ("crn" in data && data.crn != undefined) {
this.crn = data.crn;
}
}
}
get wrn() {
get crn() {
return pb_1.Message.getField(this, 1) as string;
}
set wrn(value: string) {
set crn(value: string) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
wrn?: string;
crn?: string;
}) {
const message = new QueryResolveWrn({});
if (data.wrn != null) {
message.wrn = data.wrn;
const message = new QueryResolveCrn({});
if (data.crn != null) {
message.crn = data.crn;
}
return message;
}
toObject() {
const data: {
wrn?: string;
crn?: string;
} = {};
if (this.wrn != null) {
data.wrn = this.wrn;
if (this.crn != null) {
data.crn = this.crn;
}
return data;
}
@ -1235,19 +1642,19 @@ export namespace vulcanize.nameservice.v1beta1 {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (typeof this.wrn === "string" && this.wrn.length)
writer.writeString(1, this.wrn);
if (typeof this.crn === "string" && this.crn.length)
writer.writeString(1, this.crn);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryResolveWrn {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryResolveWrn();
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryResolveCrn {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryResolveCrn();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.wrn = reader.readString();
message.crn = reader.readString();
break;
default: reader.skipField();
}
@ -1257,11 +1664,11 @@ export namespace vulcanize.nameservice.v1beta1 {
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QueryResolveWrn {
return QueryResolveWrn.deserialize(bytes);
static deserializeBinary(bytes: Uint8Array): QueryResolveCrn {
return QueryResolveCrn.deserialize(bytes);
}
}
export class QueryResolveWrnResponse extends pb_1.Message {
export class QueryResolveCrnResponse extends pb_1.Message {
constructor(data?: any[] | {
record?: dependency_1.vulcanize.nameservice.v1beta1.Record;
}) {
@ -1282,7 +1689,7 @@ export namespace vulcanize.nameservice.v1beta1 {
static fromObject(data: {
record?: ReturnType<typeof dependency_1.vulcanize.nameservice.v1beta1.Record.prototype.toObject>;
}) {
const message = new QueryResolveWrnResponse({});
const message = new QueryResolveCrnResponse({});
if (data.record != null) {
message.record = dependency_1.vulcanize.nameservice.v1beta1.Record.fromObject(data.record);
}
@ -1306,8 +1713,8 @@ export namespace vulcanize.nameservice.v1beta1 {
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryResolveWrnResponse {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryResolveWrnResponse();
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QueryResolveCrnResponse {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QueryResolveCrnResponse();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
@ -1323,8 +1730,8 @@ export namespace vulcanize.nameservice.v1beta1 {
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QueryResolveWrnResponse {
return QueryResolveWrnResponse.deserialize(bytes);
static deserializeBinary(bytes: Uint8Array): QueryResolveCrnResponse {
return QueryResolveCrnResponse.deserialize(bytes);
}
}
export class QueryGetRecordExpiryQueue extends pb_1.Message {

View File

@ -251,15 +251,15 @@ export namespace vulcanize.nameservice.v1beta1 {
}
export class MsgSetName extends pb_1.Message {
constructor(data?: any[] | {
wrn?: string;
crn?: string;
cid?: string;
signer?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("wrn" in data && data.wrn != undefined) {
this.wrn = data.wrn;
if ("crn" in data && data.crn != undefined) {
this.crn = data.crn;
}
if ("cid" in data && data.cid != undefined) {
this.cid = data.cid;
@ -269,10 +269,10 @@ export namespace vulcanize.nameservice.v1beta1 {
}
}
}
get wrn() {
get crn() {
return pb_1.Message.getField(this, 1) as string;
}
set wrn(value: string) {
set crn(value: string) {
pb_1.Message.setField(this, 1, value);
}
get cid() {
@ -288,13 +288,13 @@ export namespace vulcanize.nameservice.v1beta1 {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
wrn?: string;
crn?: string;
cid?: string;
signer?: string;
}) {
const message = new MsgSetName({});
if (data.wrn != null) {
message.wrn = data.wrn;
if (data.crn != null) {
message.crn = data.crn;
}
if (data.cid != null) {
message.cid = data.cid;
@ -306,12 +306,12 @@ export namespace vulcanize.nameservice.v1beta1 {
}
toObject() {
const data: {
wrn?: string;
crn?: string;
cid?: string;
signer?: string;
} = {};
if (this.wrn != null) {
data.wrn = this.wrn;
if (this.crn != null) {
data.crn = this.crn;
}
if (this.cid != null) {
data.cid = this.cid;
@ -325,8 +325,8 @@ export namespace vulcanize.nameservice.v1beta1 {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (typeof this.wrn === "string" && this.wrn.length)
writer.writeString(1, this.wrn);
if (typeof this.crn === "string" && this.crn.length)
writer.writeString(1, this.crn);
if (typeof this.cid === "string" && this.cid.length)
writer.writeString(2, this.cid);
if (typeof this.signer === "string" && this.signer.length)
@ -341,7 +341,7 @@ export namespace vulcanize.nameservice.v1beta1 {
break;
switch (reader.getFieldNumber()) {
case 1:
message.wrn = reader.readString();
message.crn = reader.readString();
break;
case 2:
message.cid = reader.readString();
@ -704,24 +704,24 @@ export namespace vulcanize.nameservice.v1beta1 {
}
export class MsgDeleteNameAuthority extends pb_1.Message {
constructor(data?: any[] | {
wrn?: string;
crn?: string;
signer?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], []);
if (!Array.isArray(data) && typeof data == "object") {
if ("wrn" in data && data.wrn != undefined) {
this.wrn = data.wrn;
if ("crn" in data && data.crn != undefined) {
this.crn = data.crn;
}
if ("signer" in data && data.signer != undefined) {
this.signer = data.signer;
}
}
}
get wrn() {
get crn() {
return pb_1.Message.getField(this, 1) as string;
}
set wrn(value: string) {
set crn(value: string) {
pb_1.Message.setField(this, 1, value);
}
get signer() {
@ -731,12 +731,12 @@ export namespace vulcanize.nameservice.v1beta1 {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
wrn?: string;
crn?: string;
signer?: string;
}) {
const message = new MsgDeleteNameAuthority({});
if (data.wrn != null) {
message.wrn = data.wrn;
if (data.crn != null) {
message.crn = data.crn;
}
if (data.signer != null) {
message.signer = data.signer;
@ -745,11 +745,11 @@ export namespace vulcanize.nameservice.v1beta1 {
}
toObject() {
const data: {
wrn?: string;
crn?: string;
signer?: string;
} = {};
if (this.wrn != null) {
data.wrn = this.wrn;
if (this.crn != null) {
data.crn = this.crn;
}
if (this.signer != null) {
data.signer = this.signer;
@ -760,8 +760,8 @@ export namespace vulcanize.nameservice.v1beta1 {
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (typeof this.wrn === "string" && this.wrn.length)
writer.writeString(1, this.wrn);
if (typeof this.crn === "string" && this.crn.length)
writer.writeString(1, this.crn);
if (typeof this.signer === "string" && this.signer.length)
writer.writeString(2, this.signer);
if (!w)
@ -774,7 +774,7 @@ export namespace vulcanize.nameservice.v1beta1 {
break;
switch (reader.getFieldNumber()) {
case 1:
message.wrn = reader.readString();
message.crn = reader.readString();
break;
case 2:
message.signer = reader.readString();