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

Replace Multiaddr class with an interface #202

Closed
Tracked by #3725
Gozala opened this issue Jun 24, 2021 · 1 comment · Fixed by #274
Closed
Tracked by #3725

Replace Multiaddr class with an interface #202

Gozala opened this issue Jun 24, 2021 · 1 comment · Fixed by #274
Labels

Comments

@Gozala
Copy link
Contributor

Gozala commented Jun 24, 2021

Most of ipfs / libp2p stack depends on Multiaddr class which introduces large number of dependencies, it is made worth by the fact that typescript forces all of them to agree on the same exact package to type check.

We should instead introduce Multiaddr interface and type our APIs so they take / produce value compatible with that interface. That way they become implementation agnostic allowing us to swap / upgrade implementation without coordinating these changes across the board.

Multiaddr Implementation in this library will just become a one implementation of that interface.

achingbrain added a commit that referenced this issue Sep 21, 2022
- Renames the `Multiaddr` class to `DefaultMultiaddr`
- Exports `Multiaddr` as an interface

The `multiaddr` function (introduced in v9.0.0) should be used to create new instances of `Multiaddr` instead of instantiating the `Multiaddr` class directly.

This allows us to remove the `inspect` symbol from the interface and avoid use of `Object.defineProperty` which is very slow.

Fixes: #202

BREAKING CHANGE: the `Multiaddr` class is now an interface
github-actions bot pushed a commit that referenced this issue Sep 21, 2022
## [11.0.0](v10.5.0...v11.0.0) (2022-09-21)

### ⚠ BREAKING CHANGES

* the `Multiaddr` class is now an interface

### Features

* convert to interface ([#274](#274)) ([36de98f](36de98f)), closes [#202](#202)

### Bug Fixes

* fix converting strings to IP addresses and back again ([#270](#270)) ([77f063a](77f063a))
@github-actions
Copy link

🎉 This issue has been resolved in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant