Skip to content

Commit c39d7da

Browse files
committed
always append 0x
1 parent ad834d3 commit c39d7da

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

dist/trust-min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:3fe80a1f5c4051e72d46485f26a79001c6007380ee60a75abf38db760712d661
3-
size 535220
2+
oid sha256:6fa92304a0135af876702ecfe6a9582ff78c65f504289fc9bccd866ceba51017
3+
size 535161

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class TrustWeb3Provider extends EventEmitter {
202202

203203
eth_sign(payload) {
204204
const buffer = Utils.messageToBuffer(payload.params[1]);
205-
const hex = buffer.toString("hex");
205+
const hex = Utils.bufferToHex(buffer);
206206
if (isUtf8(buffer)) {
207207
this.postMessage("signPersonalMessage", payload.id, {data: hex});
208208
} else {
@@ -215,7 +215,7 @@ class TrustWeb3Provider extends EventEmitter {
215215
const buffer = Utils.messageToBuffer(message);
216216
if (buffer.length === 0) {
217217
// hex it
218-
const hex = Buffer.from(message).toString("hex");
218+
const hex = Utils.bufferToHex(message);
219219
this.postMessage("signPersonalMessage", payload.id, {data: hex});
220220
} else {
221221
this.postMessage("signPersonalMessage", payload.id, {data: message});

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Utils {
5151
}
5252

5353
static bufferToHex(buf) {
54-
return Buffer.from(buf).toString("hex");
54+
return "0x" + Buffer.from(buf).toString("hex");
5555
}
5656
}
5757

0 commit comments

Comments
 (0)