Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [7.1.0] remove unicode chars from utf8 token symbol #6508

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions patches/@metamask+assets-controllers+5.0.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ index 332c87d..b634fde 100644
* Enumerate assets assigned to an owner.
*
diff --git a/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js b/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js
index 9ddbc28..2d12e33 100644
index 9ddbc28..b8fb35a 100644
--- a/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js
+++ b/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js
@@ -13,7 +13,13 @@ exports.ERC20Standard = void 0;
Expand Down Expand Up @@ -97,6 +97,16 @@ index 9ddbc28..2d12e33 100644
if ((decoded === null || decoded === void 0 ? void 0 : decoded.length) > 0) {
return decoded;
}
@@ -83,7 +116,8 @@ class ERC20Standard {
try {
const utf8 = (0, ethereumjs_util_1.toUtf8)(result);
if (utf8.length > 0) {
- return utf8;
+ // This utf8 returns unicode characters, wee need to replace it
+ return utf8.replace(/[\u0000\u0003\u0020]/g, '');
}
}
catch (_b) {
diff --git a/node_modules/@metamask/assets-controllers/dist/TokenDetectionController.js b/node_modules/@metamask/assets-controllers/dist/TokenDetectionController.js
index 4ed4990..da18116 100644
--- a/node_modules/@metamask/assets-controllers/dist/TokenDetectionController.js
Expand Down Expand Up @@ -526,7 +536,7 @@ index a58b709..20667c0 100644
/**
* Check if token detection is enabled for certain networks.
diff --git a/node_modules/@metamask/assets-controllers/dist/assetsUtil.js b/node_modules/@metamask/assets-controllers/dist/assetsUtil.js
index 4b54e82..aa3ffa1 100644
index 4b54e82..2322286 100644
--- a/node_modules/@metamask/assets-controllers/dist/assetsUtil.js
+++ b/node_modules/@metamask/assets-controllers/dist/assetsUtil.js
@@ -120,6 +120,7 @@ var SupportedTokenDetectionNetworks;
Expand Down