-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Proposal for web3.js: break up connection.ts into single function files under a subdirectory #23332
Comments
Do you want to split up the How would you manage backwards compatibility? Would this help with solana-labs/solana-web3.js#1122? |
I'm not familiar with what the For backwards compatibility, I'm not sure. I'm still pretty new to contributing to open-source and I haven't worked on anything like this before. I don't know how complicated it would be to ensure that these changes don't cause apps that currently use web3.js to break. Ideally, refactoring I'm going to spend some time researching this more in-depth, and I'll update my response with more details so we can have a better discussion. |
Potential solution here could be to move the exported types out into a different file - this can help shrink the size of Ultimately, it seems like having a This would be a major change in web3 and would probably lead to a version bump. Versioning can help with managing backwards compatibility |
Just from the point of view of someone who developed on solana for a while. Don’t worry about backwards compatibility. People will switch if it reduces build size by >100kb as mobile becomes more and more of a use case for crypto. It’s more important to have a good solution for projects going forward as early as possible. Biggest hurdle to adoption will be to make sure anchor uses the new api |
This will happen naturally as part of solana-labs/solana-web3.js#1111. |
Problem
Currently,
connection.ts
holds over 4000 lines of code and is cumbersome to navigate. It's possible to find a function usingcommand + F
/ctrl + F
, but there are a number of similarly named functions so you still have to do some manual filtering or enter the complete function name - not necessarily a big issue, but it could be more efficient.Proposed Solution
Split up the file into single-function files inside a
connections
folder. This would make it easier to find functions and ultimately it would be easier to maintain in the long run, especially if the codebase grows.The text was updated successfully, but these errors were encountered: