-
Notifications
You must be signed in to change notification settings - Fork 5k
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
chore: remove @metamask/ethjs
package
#29620
base: main
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@metamaskbot update-policies |
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: npm/@metamask/[email protected], npm/@metamask/[email protected], npm/[email protected] |
@metamask/ethjs
package
Policy update failed. You can review the logs or retry the policy update here |
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
345f6b1
to
0f60b67
Compare
@@ -405,19 +404,6 @@ export function getRoundedGasPrice(gasPriceEstimate) { | |||
return getGasPriceInHexWei(gasPriceAsNumber); | |||
} | |||
|
|||
export async function getERC20Balance(token, accountAddress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as not in use
@@ -90,15 +89,6 @@ const mockStore = createMockStore([thunk]); | |||
const mockAddress1 = '0xdafea492d9c6733ae3d56b7ed1adb60692c98123'; | |||
const mockNftAddress1 = 'f4831105676a5fc024684d056390b8bc529daf51c7'; | |||
|
|||
jest.mock('./send', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as getERC20Balance not in use and has been removed from helpers
4b84fee
to
c54a5c9
Compare
try { | ||
const result = await token.symbol(); | ||
return result[0]; | ||
const code = await contract.provider.getCode(tokenAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @metamask/ethjs
library is more lenient and permits interactions with non-existent contracts. This is why token.symbol() previously worked and returned an empty string (""). Now that we’ve removed ethjs, we need to first verify if the contract exists before attempting such calls.
Builds ready [c54a5c9]
Page Load Metrics (1800 ± 90 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There's this other
|
@metamaskbot update-policies |
f43efd9
to
6b3c256
Compare
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
Builds ready [d6ec3e4]
Page Load Metrics (1680 ± 111 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: why removing ethjs-*
packages is a prerequisite for the provider work?
The removal of |
Description
This PR introduces the following changes:
• Removes the
@metamask/ethjs
package.• Replaces the global variable
global.eth
with the existingglobal.ethereumProvider
(an instance ofStreamProvider
fromweb3-stream-provider
package).• Updates all instances of
getCode
to use a manualsendAsync
call for theeth_getCode
method, as StreamProvider does not include getCode, unlike ethjs.• Substitutes the use of ethjs contracts with Contract instances from the @ethersproject/contracts library.
• Removal of
@metamask/ethjs-contract
and@metamask/ethjs-query
packages.The purpose of this PR is to simplify and break down the process of replacing web3-stream-provider (issue), which uses the legacy sendAsync method and is not EIP-1193 compliant, with StreamProvider from @metamask/providers, which fully adheres to the EIP-1193 Specs.
Related issues
Fixes: partially completes #28774
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist