diff --git a/dist/generated/qrcode_data_pb.js b/dist/generated/qrcode_data_pb.js index e8174b2b4f1e8e1ca8b3caaa2da8a5dc01567de5..381181455cd978bc7d6626f095f86807d9c2cf14 100644 --- a/dist/generated/qrcode_data_pb.js +++ b/dist/generated/qrcode_data_pb.js @@ -4055,9 +4055,7 @@ $root.vereign = (function () { /** * Constructs a new SealDocumentHeadData_V1. * @memberof vereign.protobuf.qrcode_data - * @classdesc Reference - * https://community.vereign.com/t/seal-blockchain-status-storage-for-documents-and-beyond/371/6 - * Step 14 + * @classdesc Represents a SealDocumentHeadData_V1. * @implements ISealDocumentHeadData_V1 * @constructor * @param {vereign.protobuf.qrcode_data.ISealDocumentHeadData_V1=} [properties] Properties to set @@ -4279,201 +4277,6 @@ $root.vereign = (function () { }; return SealDocumentHeadData_V1; })(); - qrcode_data.Coords = (function () { - /** - * Properties of a Coords. - * @memberof vereign.protobuf.qrcode_data - * @interface ICoords - * @property {number|null} [x] Coords x - * @property {number|null} [y] Coords y - */ - /** - * Constructs a new Coords. - * @memberof vereign.protobuf.qrcode_data - * @classdesc Represents a Coords. - * @implements ICoords - * @constructor - * @param {vereign.protobuf.qrcode_data.ICoords=} [properties] Properties to set - */ - function Coords(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - /** - * Coords x. - * @member {number} x - * @memberof vereign.protobuf.qrcode_data.Coords - * @instance - */ - Coords.prototype.x = 0; - /** - * Coords y. - * @member {number} y - * @memberof vereign.protobuf.qrcode_data.Coords - * @instance - */ - Coords.prototype.y = 0; - /** - * Creates a new Coords instance using the specified properties. - * @function create - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {vereign.protobuf.qrcode_data.ICoords=} [properties] Properties to set - * @returns {vereign.protobuf.qrcode_data.Coords} Coords instance - */ - Coords.create = function create(properties) { - return new Coords(properties); - }; - /** - * Encodes the specified Coords message. Does not implicitly {@link vereign.protobuf.qrcode_data.Coords.verify|verify} messages. - * @function encode - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {vereign.protobuf.qrcode_data.ICoords} message Coords message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Coords.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.x != null && Object.hasOwnProperty.call(message, "x")) - writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.x); - if (message.y != null && Object.hasOwnProperty.call(message, "y")) - writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.y); - return writer; - }; - /** - * Encodes the specified Coords message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.Coords.verify|verify} messages. - * @function encodeDelimited - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {vereign.protobuf.qrcode_data.ICoords} message Coords message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Coords.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - /** - * Decodes a Coords message from the specified reader or buffer. - * @function decode - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {vereign.protobuf.qrcode_data.Coords} Coords - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Coords.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.Coords(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - /** - * Decodes a Coords message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {vereign.protobuf.qrcode_data.Coords} Coords - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Coords.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - /** - * Verifies a Coords message. - * @function verify - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {Object.<string,*>} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Coords.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; - return null; - }; - /** - * Creates a Coords message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {Object.<string,*>} object Plain object - * @returns {vereign.protobuf.qrcode_data.Coords} Coords - */ - Coords.fromObject = function fromObject(object) { - if (object instanceof $root.vereign.protobuf.qrcode_data.Coords) - return object; - var message = new $root.vereign.protobuf.qrcode_data.Coords(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; - return message; - }; - /** - * Creates a plain object from a Coords message. Also converts values to other types if specified. - * @function toObject - * @memberof vereign.protobuf.qrcode_data.Coords - * @static - * @param {vereign.protobuf.qrcode_data.Coords} message Coords - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.<string,*>} Plain object - */ - Coords.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; - } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; - return object; - }; - /** - * Converts this Coords to JSON. - * @function toJSON - * @memberof vereign.protobuf.qrcode_data.Coords - * @instance - * @returns {Object.<string,*>} JSON object - */ - Coords.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - return Coords; - })(); qrcode_data.SealIndexObject_V1 = (function () { /** * Properties of a SealIndexObject_V1. @@ -4482,11 +4285,8 @@ $root.vereign = (function () { * @property {Uint8Array|null} [sealKey] SealIndexObject_V1 sealKey * @property {string|null} [sealTailCid] SealIndexObject_V1 sealTailCid * @property {string|null} [chain] SealIndexObject_V1 chain - * @property {string|null} [block] SealIndexObject_V1 block - * @property {string|null} [transactionId] SealIndexObject_V1 transactionId - * @property {string|null} [hashBatchId] SealIndexObject_V1 hashBatchId - * @property {string|null} [sealSize] SealIndexObject_V1 sealSize - * @property {Object.<string,vereign.protobuf.qrcode_data.ICoords>|null} [sealCoords] SealIndexObject_V1 sealCoords + * @property {string|null} [currentBlockHeight] SealIndexObject_V1 currentBlockHeight + * @property {string|null} [accountId] SealIndexObject_V1 accountId */ /** * Constructs a new SealIndexObject_V1. @@ -4497,7 +4297,6 @@ $root.vereign = (function () { * @param {vereign.protobuf.qrcode_data.ISealIndexObject_V1=} [properties] Properties to set */ function SealIndexObject_V1(properties) { - this.sealCoords = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4525,40 +4324,19 @@ $root.vereign = (function () { */ SealIndexObject_V1.prototype.chain = ""; /** - * SealIndexObject_V1 block. - * @member {string} block - * @memberof vereign.protobuf.qrcode_data.SealIndexObject_V1 - * @instance - */ - SealIndexObject_V1.prototype.block = ""; - /** - * SealIndexObject_V1 transactionId. - * @member {string} transactionId - * @memberof vereign.protobuf.qrcode_data.SealIndexObject_V1 - * @instance - */ - SealIndexObject_V1.prototype.transactionId = ""; - /** - * SealIndexObject_V1 hashBatchId. - * @member {string} hashBatchId + * SealIndexObject_V1 currentBlockHeight. + * @member {string} currentBlockHeight * @memberof vereign.protobuf.qrcode_data.SealIndexObject_V1 * @instance */ - SealIndexObject_V1.prototype.hashBatchId = ""; + SealIndexObject_V1.prototype.currentBlockHeight = ""; /** - * SealIndexObject_V1 sealSize. - * @member {string} sealSize + * SealIndexObject_V1 accountId. + * @member {string} accountId * @memberof vereign.protobuf.qrcode_data.SealIndexObject_V1 * @instance */ - SealIndexObject_V1.prototype.sealSize = ""; - /** - * SealIndexObject_V1 sealCoords. - * @member {Object.<string,vereign.protobuf.qrcode_data.ICoords>} sealCoords - * @memberof vereign.protobuf.qrcode_data.SealIndexObject_V1 - * @instance - */ - SealIndexObject_V1.prototype.sealCoords = $util.emptyObject; + SealIndexObject_V1.prototype.accountId = ""; /** * Creates a new SealIndexObject_V1 instance using the specified properties. * @function create @@ -4588,19 +4366,10 @@ $root.vereign = (function () { writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.sealTailCid); if (message.chain != null && Object.hasOwnProperty.call(message, "chain")) writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.chain); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.block); - if (message.transactionId != null && Object.hasOwnProperty.call(message, "transactionId")) - writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.transactionId); - if (message.hashBatchId != null && Object.hasOwnProperty.call(message, "hashBatchId")) - writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.hashBatchId); - if (message.sealSize != null && Object.hasOwnProperty.call(message, "sealSize")) - writer.uint32(/* id 7, wireType 2 =*/ 58).string(message.sealSize); - if (message.sealCoords != null && Object.hasOwnProperty.call(message, "sealCoords")) - for (var keys = Object.keys(message.sealCoords), i = 0; i < keys.length; ++i) { - writer.uint32(/* id 8, wireType 2 =*/ 66).fork().uint32(/* id 1, wireType 2 =*/ 10).string(keys[i]); - $root.vereign.protobuf.qrcode_data.Coords.encode(message.sealCoords[keys[i]], writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim().ldelim(); - } + if (message.currentBlockHeight != null && Object.hasOwnProperty.call(message, "currentBlockHeight")) + writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.currentBlockHeight); + if (message.accountId != null && Object.hasOwnProperty.call(message, "accountId")) + writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.accountId); return writer; }; /** @@ -4629,7 +4398,7 @@ $root.vereign = (function () { SealIndexObject_V1.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.SealIndexObject_V1(), key, value; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.SealIndexObject_V1(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -4643,38 +4412,10 @@ $root.vereign = (function () { message.chain = reader.string(); break; case 4: - message.block = reader.string(); + message.currentBlockHeight = reader.string(); break; case 5: - message.transactionId = reader.string(); - break; - case 6: - message.hashBatchId = reader.string(); - break; - case 7: - message.sealSize = reader.string(); - break; - case 8: - if (message.sealCoords === $util.emptyObject) - message.sealCoords = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = null; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = $root.vereign.protobuf.qrcode_data.Coords.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.sealCoords[key] = value; + message.accountId = reader.string(); break; default: reader.skipType(tag & 7); @@ -4718,28 +4459,12 @@ $root.vereign = (function () { if (message.chain != null && message.hasOwnProperty("chain")) if (!$util.isString(message.chain)) return "chain: string expected"; - if (message.block != null && message.hasOwnProperty("block")) - if (!$util.isString(message.block)) - return "block: string expected"; - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - if (!$util.isString(message.transactionId)) - return "transactionId: string expected"; - if (message.hashBatchId != null && message.hasOwnProperty("hashBatchId")) - if (!$util.isString(message.hashBatchId)) - return "hashBatchId: string expected"; - if (message.sealSize != null && message.hasOwnProperty("sealSize")) - if (!$util.isString(message.sealSize)) - return "sealSize: string expected"; - if (message.sealCoords != null && message.hasOwnProperty("sealCoords")) { - if (!$util.isObject(message.sealCoords)) - return "sealCoords: object expected"; - var key = Object.keys(message.sealCoords); - for (var i = 0; i < key.length; ++i) { - var error = $root.vereign.protobuf.qrcode_data.Coords.verify(message.sealCoords[key[i]]); - if (error) - return "sealCoords." + error; - } - } + if (message.currentBlockHeight != null && message.hasOwnProperty("currentBlockHeight")) + if (!$util.isString(message.currentBlockHeight)) + return "currentBlockHeight: string expected"; + if (message.accountId != null && message.hasOwnProperty("accountId")) + if (!$util.isString(message.accountId)) + return "accountId: string expected"; return null; }; /** @@ -4763,24 +4488,10 @@ $root.vereign = (function () { message.sealTailCid = String(object.sealTailCid); if (object.chain != null) message.chain = String(object.chain); - if (object.block != null) - message.block = String(object.block); - if (object.transactionId != null) - message.transactionId = String(object.transactionId); - if (object.hashBatchId != null) - message.hashBatchId = String(object.hashBatchId); - if (object.sealSize != null) - message.sealSize = String(object.sealSize); - if (object.sealCoords) { - if (typeof object.sealCoords !== "object") - throw TypeError(".vereign.protobuf.qrcode_data.SealIndexObject_V1.sealCoords: object expected"); - message.sealCoords = {}; - for (var keys = Object.keys(object.sealCoords), i = 0; i < keys.length; ++i) { - if (typeof object.sealCoords[keys[i]] !== "object") - throw TypeError(".vereign.protobuf.qrcode_data.SealIndexObject_V1.sealCoords: object expected"); - message.sealCoords[keys[i]] = $root.vereign.protobuf.qrcode_data.Coords.fromObject(object.sealCoords[keys[i]]); - } - } + if (object.currentBlockHeight != null) + message.currentBlockHeight = String(object.currentBlockHeight); + if (object.accountId != null) + message.accountId = String(object.accountId); return message; }; /** @@ -4796,8 +4507,6 @@ $root.vereign = (function () { if (!options) options = {}; var object = {}; - if (options.objects || options.defaults) - object.sealCoords = {}; if (options.defaults) { if (options.bytes === String) object.sealKey = ""; @@ -4808,10 +4517,8 @@ $root.vereign = (function () { } object.sealTailCid = ""; object.chain = ""; - object.block = ""; - object.transactionId = ""; - object.hashBatchId = ""; - object.sealSize = ""; + object.currentBlockHeight = ""; + object.accountId = ""; } if (message.sealKey != null && message.hasOwnProperty("sealKey")) object.sealKey = options.bytes === String ? $util.base64.encode(message.sealKey, 0, message.sealKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.sealKey) : message.sealKey; @@ -4819,20 +4526,10 @@ $root.vereign = (function () { object.sealTailCid = message.sealTailCid; if (message.chain != null && message.hasOwnProperty("chain")) object.chain = message.chain; - if (message.block != null && message.hasOwnProperty("block")) - object.block = message.block; - if (message.transactionId != null && message.hasOwnProperty("transactionId")) - object.transactionId = message.transactionId; - if (message.hashBatchId != null && message.hasOwnProperty("hashBatchId")) - object.hashBatchId = message.hashBatchId; - if (message.sealSize != null && message.hasOwnProperty("sealSize")) - object.sealSize = message.sealSize; - var keys2; - if (message.sealCoords && (keys2 = Object.keys(message.sealCoords)).length) { - object.sealCoords = {}; - for (var j = 0; j < keys2.length; ++j) - object.sealCoords[keys2[j]] = $root.vereign.protobuf.qrcode_data.Coords.toObject(message.sealCoords[keys2[j]], options); - } + if (message.currentBlockHeight != null && message.hasOwnProperty("currentBlockHeight")) + object.currentBlockHeight = message.currentBlockHeight; + if (message.accountId != null && message.hasOwnProperty("accountId")) + object.accountId = message.accountId; return object; }; /** diff --git a/dist/types.d.ts b/dist/types.d.ts index 2be80a742bded9e1df4f05fd8db5320a63eb15f6..fb3181c856aedc53910a7ce556054bf37729f04b 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -199,8 +199,6 @@ export interface SealIndexObject { sealKey: string; sealTailCid: string; chain: string; - transactionId: string; - hashBatchId: string; - sealSize: string; - sealCoords: SealCoords; + currentBlockHeight: number; + accountId: string; } diff --git a/src/types.ts b/src/types.ts index 74d89179291d2d3fc8863c7f6131ed5d8a843c39..80a5e9818de53f4e890de0a394a6506eebcbefd6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -216,12 +216,11 @@ export interface SealHeadData { export interface SealCoords { [key: string]: { x: string; y: string }; } + export interface SealIndexObject { sealKey: string; sealTailCid: string; chain: string; - transactionId: string; - hashBatchId: string; - sealSize: string; - sealCoords: SealCoords; + currentBlockHeight: number; + accountId: string; } diff --git a/vereign/protobuf/qrcode_data.proto b/vereign/protobuf/qrcode_data.proto index 2d61b4b0e71bb9b3efd7bcca485d8be6169a4a6e..2b2f15a365beec0183556265bea8339bcd81031a 100644 --- a/vereign/protobuf/qrcode_data.proto +++ b/vereign/protobuf/qrcode_data.proto @@ -115,29 +115,16 @@ message DocumentData_V1 { IpfsContentData_V1 ipfs = 8; } -/** - * Reference - * https://community.vereign.com/t/seal-blockchain-status-storage-for-documents-and-beyond/371/6 - * Step 14 - */ message SealDocumentHeadData_V1 { bytes key = 1; bytes data = 2; string ipfsIndexCid = 3; } -message Coords { - int32 x = 1; - int32 y = 2; -} - message SealIndexObject_V1 { bytes sealKey = 1; string sealTailCid = 2; string chain = 3; - string block = 4; - string transactionId = 5; - string hashBatchId = 6; - string sealSize = 7; - map<string, Coords> sealCoords = 8; + string currentBlockHeight = 4; + string accountId = 5; }