From 7d3cd9f8c1f5cff5e27ec997b519f22239a51f9a Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 4 Sep 2019 15:50:49 +0200 Subject: [PATCH] Fix swarm hash extraction --- remix-lib/src/util.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/remix-lib/src/util.js b/remix-lib/src/util.js index d0b5ee86ef..04899c29c2 100644 --- a/remix-lib/src/util.js +++ b/remix-lib/src/util.js @@ -180,13 +180,23 @@ module.exports = { * * @return {RegEx} */ - swarmHashExtractionPOC3: function () { + swarmHashExtractionPOC31: function () { return /a265627a7a72315820([0-9a-f]{64})64736f6c6343([0-9a-f]{6})0032$/ }, + /** + * return a regex which extract the swarmhash from the bytecode, from POC 0.3 + * + * @return {RegEx} + */ + swarmHashExtractionPOC32: function () { + return /a265627a7a72305820([0-9a-f]{64})64736f6c6343([0-9a-f]{6})0032$/ + }, + extractSwarmHash: function (value) { value = value.replace(this.swarmHashExtraction(), '') - value = value.replace(this.swarmHashExtractionPOC3(), '') + value = value.replace(this.swarmHashExtractionPOC31(), '') + value = value.replace(this.swarmHashExtractionPOC32(), '') return value },