diff --git a/dist/trust-min.js b/dist/trust-min.js index f885ee9c..2b9bb635 100644 --- a/dist/trust-min.js +++ b/dist/trust-min.js @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3fe80a1f5c4051e72d46485f26a79001c6007380ee60a75abf38db760712d661 -size 535220 +oid sha256:6fa92304a0135af876702ecfe6a9582ff78c65f504289fc9bccd866ceba51017 +size 535161 diff --git a/src/index.js b/src/index.js index c665c7d8..b7c6ca55 100644 --- a/src/index.js +++ b/src/index.js @@ -202,7 +202,7 @@ class TrustWeb3Provider extends EventEmitter { eth_sign(payload) { const buffer = Utils.messageToBuffer(payload.params[1]); - const hex = buffer.toString("hex"); + const hex = Utils.bufferToHex(buffer); if (isUtf8(buffer)) { this.postMessage("signPersonalMessage", payload.id, {data: hex}); } else { @@ -215,7 +215,7 @@ class TrustWeb3Provider extends EventEmitter { const buffer = Utils.messageToBuffer(message); if (buffer.length === 0) { // hex it - const hex = Buffer.from(message).toString("hex"); + const hex = Utils.bufferToHex(message); this.postMessage("signPersonalMessage", payload.id, {data: hex}); } else { this.postMessage("signPersonalMessage", payload.id, {data: message}); diff --git a/src/utils.js b/src/utils.js index 60a0293c..1c187641 100644 --- a/src/utils.js +++ b/src/utils.js @@ -51,7 +51,7 @@ class Utils { } static bufferToHex(buf) { - return Buffer.from(buf).toString("hex"); + return "0x" + Buffer.from(buf).toString("hex"); } }