@alephium/web3 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/utils/utils.js
CHANGED
|
@@ -233,6 +233,9 @@ function stringToHex(str) {
|
|
|
233
233
|
}
|
|
234
234
|
exports.stringToHex = stringToHex;
|
|
235
235
|
function hexToString(str) {
|
|
236
|
+
if (!isHexString(str)) {
|
|
237
|
+
throw new Error(`Invalid hex string: ${str}`);
|
|
238
|
+
}
|
|
236
239
|
return buffer_1.Buffer.from(str, 'hex').toString();
|
|
237
240
|
}
|
|
238
241
|
exports.hexToString = hexToString;
|
package/package.json
CHANGED
package/src/utils/utils.ts
CHANGED
|
@@ -242,6 +242,9 @@ export function stringToHex(str: string): string {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
export function hexToString(str: string): string {
|
|
245
|
+
if (!isHexString(str)) {
|
|
246
|
+
throw new Error(`Invalid hex string: ${str}`)
|
|
247
|
+
}
|
|
245
248
|
return Buffer.from(str, 'hex').toString()
|
|
246
249
|
}
|
|
247
250
|
|