gridplus-sdk
Advanced tools
Comparing version 0.7.21 to 0.7.22
{ | ||
"name": "gridplus-sdk", | ||
"version": "0.7.21", | ||
"version": "0.7.22", | ||
"description": "SDK to interact with GridPlus Lattice1 device", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -434,5 +434,6 @@ // Utils for Ethereum transactions. This is effecitvely a shim of ethereumjs-util, which | ||
// For null values, return a 0-sized buffer | ||
if (x === null || x === 0) return Buffer.alloc(0); | ||
if (x === null) return Buffer.alloc(0); | ||
const isNumber = typeof x === 'number' || isBase10NumStr(x); | ||
// Otherwise try to get this converted to a hex string | ||
if (typeof x === 'number' || isBase10NumStr(x)) { | ||
if (isNumber) { | ||
// If this is a number or a base-10 number string, convert it to hex | ||
@@ -446,3 +447,3 @@ x = `${new BN(x).toString(16)}`; | ||
if (x.length % 2 > 0) x = `0${x}`; | ||
if (x === '00') | ||
if (x === '00' && !isNumber) | ||
return Buffer.alloc(0); | ||
@@ -630,4 +631,2 @@ return Buffer.from(x, 'hex'); | ||
data = ensureHexBuffer(data); | ||
if (data.length === 0) | ||
throw new Error('"bytes" type must contain at least one byte in value'); | ||
} else if (type.slice(0, 5) === 'bytes') { | ||
@@ -634,0 +633,0 @@ // Fixed sizes bytes need to be buffer type. We also add some sanity checks. |
105048
2399