Comparing version 4.3.1 to 4.3.3
[ | ||
{ | ||
"version": "4.3.3", | ||
"changes": [ | ||
{ | ||
"note": "Fixed spelling error in ABI Encoder error message", | ||
"pr": 1808 | ||
} | ||
], | ||
"timestamp": 1557507213 | ||
}, | ||
{ | ||
"version": "4.3.2", | ||
"changes": [ | ||
{ | ||
"note": "Support for ABI encoding multibyte strings (fixes issue #1723)", | ||
"pr": 1806 | ||
} | ||
] | ||
}, | ||
{ | ||
"version": "4.3.1", | ||
@@ -4,0 +23,0 @@ "changes": [ |
@@ -8,2 +8,10 @@ <!-- | ||
## v4.3.3 - _May 10, 2019_ | ||
* Fixed spelling error in ABI Encoder error message (#1808) | ||
## v4.3.2 - _Invalid date_ | ||
* Support for ABI encoding multibyte strings (fixes issue #1723) (#1806) | ||
## v4.3.1 - _April 11, 2019_ | ||
@@ -10,0 +18,0 @@ |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (!_.startsWith(value, '0x')) { | ||
throw new Error("Tried to encode non-hex value. Value must inlcude '0x' prefix."); | ||
throw new Error("Tried to encode non-hex value. Value must include '0x' prefix."); | ||
} | ||
@@ -41,0 +41,0 @@ else if (value.length % 2 !== 0) { |
@@ -69,3 +69,3 @@ "use strict"; | ||
if (!_.startsWith(value, '0x')) { | ||
throw new Error("Tried to encode non-hex value. Value must inlcude '0x' prefix."); | ||
throw new Error("Tried to encode non-hex value. Value must include '0x' prefix."); | ||
} | ||
@@ -72,0 +72,0 @@ else if (value.length % 2 !== 0) { |
@@ -36,10 +36,11 @@ "use strict"; | ||
// Encoded value is of the form: <length><value>, with each field padded to be word-aligned. | ||
// 1/3 Construct the length | ||
var wordsToStoreValuePadded = Math.ceil(value.length / constants_1.constants.EVM_WORD_WIDTH_IN_BYTES); | ||
// 1/3 Construct the value | ||
var valueBuf = new Buffer(value); | ||
var valueLengthInBytes = valueBuf.byteLength; | ||
var wordsToStoreValuePadded = Math.ceil(valueLengthInBytes / constants_1.constants.EVM_WORD_WIDTH_IN_BYTES); | ||
var bytesToStoreValuePadded = wordsToStoreValuePadded * constants_1.constants.EVM_WORD_WIDTH_IN_BYTES; | ||
var lengthBuf = ethUtil.toBuffer(value.length); | ||
var valueBufPadded = ethUtil.setLengthRight(valueBuf, bytesToStoreValuePadded); | ||
// 2/3 Construct the length | ||
var lengthBuf = ethUtil.toBuffer(valueLengthInBytes); | ||
var lengthBufPadded = ethUtil.setLengthLeft(lengthBuf, constants_1.constants.EVM_WORD_WIDTH_IN_BYTES); | ||
// 2/3 Construct the value | ||
var valueBuf = new Buffer(value); | ||
var valueBufPadded = ethUtil.setLengthRight(valueBuf, bytesToStoreValuePadded); | ||
// 3/3 Combine length and value | ||
@@ -59,3 +60,3 @@ var encodedValue = Buffer.concat([lengthBufPadded, valueBufPadded]); | ||
var valueBuf = valueBufPadded.slice(0, length); | ||
var value = valueBuf.toString('ascii'); | ||
var value = valueBuf.toString('UTF-8'); | ||
return value; | ||
@@ -62,0 +63,0 @@ }; |
{ | ||
"name": "@0x/utils", | ||
"version": "4.3.1", | ||
"version": "4.3.3", | ||
"engines": { | ||
@@ -65,3 +65,3 @@ "node": ">=6.12" | ||
}, | ||
"gitHead": "c78a60299053f0ec825bf34dd3ea0cea7bb9365b" | ||
"gitHead": "490aafba4e2c5a6123ca62f70054a743eb4b904f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
728930
9568