-
Notifications
You must be signed in to change notification settings - Fork 260
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
♻️ Refactor address #232
Merged
Merged
♻️ Refactor address #232
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add Base58Check - Remove publicKeyHashToAddress() - Refactor related directories - Refactor Encoding files
39a9d58
to
85eec68
Compare
I realized that the change is too destructive. |
5a36a29
to
f385670
Compare
Refactorization is finished. |
- Braek down address related files into smaller files - Introduce Address struct instead of protocol - Add BitcoinScheme - Add Address.VersionByte - Add Address.HashSize - Add Address.HashType (AddressType is renamed) - Deprecate Cashaddr, LegacyAddress - Add documentation for Address, Cashaddr, LegacyAddress - Rename Network.mainnet to Network.mainnetBCH - Rename Network.testnetBCH to Network.testnetBCH - Modify Address.cashaddr and .legacy to be computed properties
f385670
to
f7adda2
Compare
- Modify fatalError to assertionFailure in BitcoinAddress.cashaddr
usatie
commented
Sep 21, 2019
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Refactor
Address
,LegacyAddress
,Cashaddr
,Base58Check
,Bech32
.Before,
Address
was protocol, but it will be a struct in version 2.0.0.Before (v1.0.2 = Latest Release)
After (v1.1.0 = Next Release)
v1.0.2 code is also available, but deprecated
Future (v2.0.0 = Major Update)
v1.0.2 code is also unavailable
Benefits
Address+Legacy.swift
andAddress+Cashaddr.swift
are good example of implementing new formats.Possible Drawbacks
Address.publicKey
may cause users to rewrite their codes. However, the public key is not the information which should be kept in Address. So those who need public key information with address should usePublicKey
instead ofAddress
.