Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit 0103d17

Browse files
committed
fixup! feat: Support Ethereum EIP-712 Sign Typed Data
Replace TextEncoder with Buffer.from(x, "utf-8).toString("hex") for IE support.
1 parent aecbf6b commit 0103d17

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/js/core/methods/EthereumSignTypedData.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ export default class EthereumSignTypedData extends AbstractMethod {
157157
// $FlowIssue typedCall problem with unions in response, TODO: accept unions
158158
'EthereumTypedDataValueRequest|EthereumTypedDataSignature',
159159
{
160-
// $FlowIssue protobuf.js is okay with Uint8Array: TODO: update scripts/protobuf-types.js
161160
value: encodedData,
162161
},
163162
);

src/js/core/methods/helpers/ethereumTypeDataConversions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ function intToHex(
8686
* @param data - The actual data to convert.
8787
* @returns Hex string of the data.
8888
*/
89-
export function encodeData(typeName: string, data: any): string | Uint8Array {
89+
export function encodeData(typeName: string, data: any): string {
9090
if (paramTypeBytes.test(typeName) || typeName === 'address') {
9191
return stripHexPrefix(data);
9292
}
9393
if (typeName === 'string') {
94-
return new TextEncoder().encode(data);
94+
return Buffer.from(data, 'utf-8').toString('hex');
9595
}
9696
const numberMatch = paramTypeNumber.exec(typeName);
9797
if (numberMatch) {

0 commit comments

Comments
 (0)