-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Narrow type of provider argument #57
base: main
Are you sure you want to change the base?
Conversation
Previously, the `provider` could be any kind of object. Now, it must be an instance of SafeEventEmitterProvider. This allows us to replace Web3Provider with `@metamask/eth-query` in a future PR.
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Next stepsWhat is bin script confusion?This package has multiple bin scripts with the same name. This can cause non-deterministic behavior when installing or could be a sign of a supply chain attack Consider removing one of the conflicting packages. Packages should only export bin scripts with their name Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
Bin script confusion makes sense. |
@@ -1,5 +1,6 @@ | |||
import assert from 'assert'; | |||
import { Mutex } from 'async-mutex'; | |||
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider'; |
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.
Would it be viable to have this type broken out to a separate package, if not either inlined or in .d.ts
file here? Looking at the lockfile diff, it's quite a lot of transitive dependencies pulled in for a single type-declaration, which won't even be present at runtime...
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 had this thought which may or may not be relevant here: what if type-only imports went back to devDependencies
, but with the addition of a build/bundle-step which ensures that any types used by them are included in published packages in d.ts
declarations?
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.
Is there an easy way to do that?
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.
Ah sorry I didn't see this comment before.
Because @metamask/eth-json-rpc-provider
shows up in the type declaration, it can't be in devDependencies
, it has to be in dependencies
instead. This ensures that TypeScript consumers automatically get the type definitions for this import and do not have to add it themselves.
I know that we've discussed splitting this type off before. I am not opposed to that, I am just unsure where. Also, I suspect that most of these transitive dependencies are coming from @metamask/utils
. I will open a discussion in chat for this since I feel like it might be easier to talk there.
Previously, the
provider
could be any kind of object. Now, it must be an instance of SafeEventEmitterProvider. This allows us to replace Web3Provider with@metamask/eth-query
in a future PR (see #58).