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] Patch assets-controller to not use BigInt #6305

Merged
merged 5 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"@eth-optimism/contracts": "0.0.0-2021919175625",
"@ethereumjs/common": "^2.3.1",
"@ethereumjs/tx": "^3.2.1",
"@ethersproject/abi": "^5.7.0",
"@exodus/react-native-payments": "git+https://github.com/MetaMask/react-native-payments.git#dbc8cbbed570892d2fea5e3d183bf243e062c1e5",
"@keystonehq/bc-ur-registry-eth": "^0.7.7",
"@keystonehq/metamask-airgapped-keyring": "^0.3.0",
Expand Down
38 changes: 36 additions & 2 deletions patches/@metamask+assets-controllers+4.0.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,25 @@ index 332c87d..c110f41 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..acdc28a 100644
index 9ddbc28..2d12e33 100644
--- a/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js
+++ b/node_modules/@metamask/assets-controllers/dist/Standards/ERC20Standard.js
@@ -57,6 +57,27 @@ class ERC20Standard {
@@ -13,7 +13,13 @@ exports.ERC20Standard = void 0;
const contracts_1 = require("@ethersproject/contracts");
const metamask_eth_abis_1 = require("@metamask/metamask-eth-abis");
const ethereumjs_util_1 = require("ethereumjs-util");
-const abi_utils_1 = require("@metamask/abi-utils");
+
+// Revert to use @ethersproject/abi to fix BigInt compatibility issue
+// Issue reported here - https://github.com/MetaMask/metamask-mobile/issues/6307
+// TODO - Remove patch once app is upgraded to React Native 0.71.6
+// const abi_utils_1 = require("@metamask/abi-utils");
+const ethers_project_abi = require('@ethersproject/abi');
+
const controller_utils_1 = require("@metamask/controller-utils");
const utils_1 = require("@metamask/utils");
const assetsUtil_1 = require("../assetsUtil");
@@ -57,6 +63,27 @@ class ERC20Standard {
}
});
}
Expand Down Expand Up @@ -55,6 +70,25 @@ index 9ddbc28..acdc28a 100644
/**
* Query for symbol for a given ERC20 asset.
*
@@ -68,10 +95,16 @@ class ERC20Standard {
// Signature for calling `symbol()`
const payload = { to: address, data: '0x95d89b41' };
const result = yield this.provider.call(payload);
- (0, utils_1.assertIsStrictHexString)(result);
+
+ // TODO - Remove patch once app is upgraded to RN 0.71.6
+ // (0, utils_1.assertIsStrictHexString)(result);
+
// Parse as string - treat empty string as failure
try {
- const decoded = (0, abi_utils_1.decodeSingle)('string', result);
+ // TODO - Remove patch once app is upgraded to React Native 0.71.6
+ const decoded = ethers_project_abi.abiCoder.decode(['string'], result)[0];
+ // const decoded = (0, abi_utils_1.decodeSingle)('string', result);
+
if ((decoded === null || decoded === void 0 ? void 0 : decoded.length) > 0) {
return decoded;
}
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