Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Commit

Permalink
feat: update according to hyperledger/iroha#1837
Browse files Browse the repository at this point in the history
  • Loading branch information
laSinteZ committed Nov 15, 2018
1 parent e82956f commit 6dbb2a6
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 22 deletions.
8 changes: 8 additions & 0 deletions src/proto/block_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export namespace Block {
getCreatedTime(): number;
setCreatedTime(value: number): void;

clearRejectedTransactionsHashesList(): void;
getRejectedTransactionsHashesList(): Array<Uint8Array | string>;
getRejectedTransactionsHashesList_asU8(): Array<Uint8Array>;
getRejectedTransactionsHashesList_asB64(): Array<string>;
setRejectedTransactionsHashesList(value: Array<Uint8Array | string>): void;
addRejectedTransactionsHashes(value: Uint8Array | string, index?: number): Uint8Array | string;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Payload.AsObject;
static toObject(includeInstance: boolean, msg: Payload): Payload.AsObject;
Expand All @@ -69,6 +76,7 @@ export namespace Block {
height: number,
prevBlockHash: Uint8Array | string,
createdTime: number,
rejectedTransactionsHashesList: Array<Uint8Array | string>,
}
}
}
Expand Down
91 changes: 78 additions & 13 deletions src/proto/block_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if (goog.DEBUG && !COMPILED) {
* @private {!Array<number>}
* @const
*/
proto.iroha.protocol.Block.Payload.repeatedFields_ = [1];
proto.iroha.protocol.Block.Payload.repeatedFields_ = [1,6];



Expand Down Expand Up @@ -225,7 +225,8 @@ proto.iroha.protocol.Block.Payload.toObject = function(includeInstance, msg) {
txNumber: jspb.Message.getFieldWithDefault(msg, 2, 0),
height: jspb.Message.getFieldWithDefault(msg, 3, 0),
prevBlockHash: msg.getPrevBlockHash_asB64(),
createdTime: jspb.Message.getFieldWithDefault(msg, 6, 0)
createdTime: jspb.Message.getFieldWithDefault(msg, 5, 0),
rejectedTransactionsHashesList: msg.getRejectedTransactionsHashesList_asB64()
};

if (includeInstance) {
Expand Down Expand Up @@ -275,14 +276,18 @@ proto.iroha.protocol.Block.Payload.deserializeBinaryFromReader = function(msg, r
var value = /** @type {number} */ (reader.readUint64());
msg.setHeight(value);
break;
case 5:
case 4:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setPrevBlockHash(value);
break;
case 6:
case 5:
var value = /** @type {number} */ (reader.readUint64());
msg.setCreatedTime(value);
break;
case 6:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.addRejectedTransactionsHashes(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -337,13 +342,20 @@ proto.iroha.protocol.Block.Payload.serializeBinaryToWriter = function(message, w
f = message.getPrevBlockHash_asU8();
if (f.length > 0) {
writer.writeBytes(
5,
4,
f
);
}
f = message.getCreatedTime();
if (f !== 0) {
writer.writeUint64(
5,
f
);
}
f = message.getRejectedTransactionsHashesList_asU8();
if (f.length > 0) {
writer.writeRepeatedBytes(
6,
f
);
Expand Down Expand Up @@ -413,16 +425,16 @@ proto.iroha.protocol.Block.Payload.prototype.setHeight = function(value) {


/**
* optional bytes prev_block_hash = 5;
* optional bytes prev_block_hash = 4;
* @return {!(string|Uint8Array)}
*/
proto.iroha.protocol.Block.Payload.prototype.getPrevBlockHash = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};


/**
* optional bytes prev_block_hash = 5;
* optional bytes prev_block_hash = 4;
* This is a type-conversion wrapper around `getPrevBlockHash()`
* @return {string}
*/
Expand All @@ -433,7 +445,7 @@ proto.iroha.protocol.Block.Payload.prototype.getPrevBlockHash_asB64 = function()


/**
* optional bytes prev_block_hash = 5;
* optional bytes prev_block_hash = 4;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getPrevBlockHash()`
Expand All @@ -447,22 +459,75 @@ proto.iroha.protocol.Block.Payload.prototype.getPrevBlockHash_asU8 = function()

/** @param {!(string|Uint8Array)} value */
proto.iroha.protocol.Block.Payload.prototype.setPrevBlockHash = function(value) {
jspb.Message.setProto3BytesField(this, 5, value);
jspb.Message.setProto3BytesField(this, 4, value);
};


/**
* optional uint64 created_time = 6;
* optional uint64 created_time = 5;
* @return {number}
*/
proto.iroha.protocol.Block.Payload.prototype.getCreatedTime = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};


/** @param {number} value */
proto.iroha.protocol.Block.Payload.prototype.setCreatedTime = function(value) {
jspb.Message.setProto3IntField(this, 6, value);
jspb.Message.setProto3IntField(this, 5, value);
};


/**
* repeated bytes rejected_transactions_hashes = 6;
* @return {!(Array<!Uint8Array>|Array<string>)}
*/
proto.iroha.protocol.Block.Payload.prototype.getRejectedTransactionsHashesList = function() {
return /** @type {!(Array<!Uint8Array>|Array<string>)} */ (jspb.Message.getRepeatedField(this, 6));
};


/**
* repeated bytes rejected_transactions_hashes = 6;
* This is a type-conversion wrapper around `getRejectedTransactionsHashesList()`
* @return {!Array.<string>}
*/
proto.iroha.protocol.Block.Payload.prototype.getRejectedTransactionsHashesList_asB64 = function() {
return /** @type {!Array.<string>} */ (jspb.Message.bytesListAsB64(
this.getRejectedTransactionsHashesList()));
};


/**
* repeated bytes rejected_transactions_hashes = 6;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getRejectedTransactionsHashesList()`
* @return {!Array.<!Uint8Array>}
*/
proto.iroha.protocol.Block.Payload.prototype.getRejectedTransactionsHashesList_asU8 = function() {
return /** @type {!Array.<!Uint8Array>} */ (jspb.Message.bytesListAsU8(
this.getRejectedTransactionsHashesList()));
};


/** @param {!(Array<!Uint8Array>|Array<string>)} value */
proto.iroha.protocol.Block.Payload.prototype.setRejectedTransactionsHashesList = function(value) {
jspb.Message.setField(this, 6, value || []);
};


/**
* @param {!(string|Uint8Array)} value
* @param {number=} opt_index
*/
proto.iroha.protocol.Block.Payload.prototype.addRejectedTransactionsHashes = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 6, value, opt_index);
};


proto.iroha.protocol.Block.Payload.prototype.clearRejectedTransactionsHashesList = function() {
this.setRejectedTransactionsHashesList([]);
};


Expand Down
14 changes: 11 additions & 3 deletions src/proto/endpoint_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ export class ToriiResponse extends jspb.Message {
getTxHash_asB64(): string;
setTxHash(value: Uint8Array | string): void;

getErrorMessage(): string;
setErrorMessage(value: string): void;
getErrOrCmdName(): string;
setErrOrCmdName(value: string): void;

getFailedCmdIndex(): number;
setFailedCmdIndex(value: number): void;

getErrorCode(): number;
setErrorCode(value: number): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ToriiResponse.AsObject;
Expand All @@ -33,7 +39,9 @@ export namespace ToriiResponse {
export type AsObject = {
txStatus: TxStatus,
txHash: Uint8Array | string,
errorMessage: string,
errOrCmdName: string,
failedCmdIndex: number,
errorCode: number,
}
}

Expand Down
66 changes: 60 additions & 6 deletions src/proto/endpoint_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ proto.iroha.protocol.ToriiResponse.toObject = function(includeInstance, msg) {
var f, obj = {
txStatus: jspb.Message.getFieldWithDefault(msg, 1, 0),
txHash: msg.getTxHash_asB64(),
errorMessage: jspb.Message.getFieldWithDefault(msg, 3, "")
errOrCmdName: jspb.Message.getFieldWithDefault(msg, 3, ""),
failedCmdIndex: jspb.Message.getFieldWithDefault(msg, 4, 0),
errorCode: jspb.Message.getFieldWithDefault(msg, 5, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -115,7 +117,15 @@ proto.iroha.protocol.ToriiResponse.deserializeBinaryFromReader = function(msg, r
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setErrorMessage(value);
msg.setErrOrCmdName(value);
break;
case 4:
var value = /** @type {number} */ (reader.readUint64());
msg.setFailedCmdIndex(value);
break;
case 5:
var value = /** @type {number} */ (reader.readUint32());
msg.setErrorCode(value);
break;
default:
reader.skipField();
Expand Down Expand Up @@ -160,13 +170,27 @@ proto.iroha.protocol.ToriiResponse.serializeBinaryToWriter = function(message, w
f
);
}
f = message.getErrorMessage();
f = message.getErrOrCmdName();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getFailedCmdIndex();
if (f !== 0) {
writer.writeUint64(
4,
f
);
}
f = message.getErrorCode();
if (f !== 0) {
writer.writeUint32(
5,
f
);
}
};


Expand Down Expand Up @@ -225,20 +249,50 @@ proto.iroha.protocol.ToriiResponse.prototype.setTxHash = function(value) {


/**
* optional string error_message = 3;
* optional string err_or_cmd_name = 3;
* @return {string}
*/
proto.iroha.protocol.ToriiResponse.prototype.getErrorMessage = function() {
proto.iroha.protocol.ToriiResponse.prototype.getErrOrCmdName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};


/** @param {string} value */
proto.iroha.protocol.ToriiResponse.prototype.setErrorMessage = function(value) {
proto.iroha.protocol.ToriiResponse.prototype.setErrOrCmdName = function(value) {
jspb.Message.setProto3StringField(this, 3, value);
};


/**
* optional uint64 failed_cmd_index = 4;
* @return {number}
*/
proto.iroha.protocol.ToriiResponse.prototype.getFailedCmdIndex = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};


/** @param {number} value */
proto.iroha.protocol.ToriiResponse.prototype.setFailedCmdIndex = function(value) {
jspb.Message.setProto3IntField(this, 4, value);
};


/**
* optional uint32 error_code = 5;
* @return {number}
*/
proto.iroha.protocol.ToriiResponse.prototype.getErrorCode = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};


/** @param {number} value */
proto.iroha.protocol.ToriiResponse.prototype.setErrorCode = function(value) {
jspb.Message.setProto3IntField(this, 5, value);
};



/**
* Generated by JsPbCodeGenerator.
Expand Down

0 comments on commit 6dbb2a6

Please sign in to comment.