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

Feature/BIP44 #719

Merged
merged 22 commits into from Jan 19, 2023
Merged

Conversation

albertopeam
Copy link
Contributor

@albertopeam albertopeam commented Dec 28, 2022

Summary of Changes

Adds bip44 to HDNode

Test Data or Screenshots

By submitting this pull request, you are confirming the following:
  • I have reviewed the Contribution Guidelines.
  • I have performed a self-review of my own code.
  • I have updated my repository to match the develop branch.
  • I have included test data or screenshots that prove my fix is effective or that my feature works.
  • I have checked that all tests work and swiftlint is not throwing any errors/warnings.

@albertopeam
Copy link
Contributor Author

having some issues with swiftlint... I expect to fix them soon

@albertopeam
Copy link
Contributor Author

fixed swiftlint issues

Sources/Web3Core/KeystoreManager/BIP44.swift Outdated Show resolved Hide resolved
Sources/Web3Core/KeystoreManager/BIP44.swift Outdated Show resolved Hide resolved
Sources/Web3Core/KeystoreManager/BIP44.swift Outdated Show resolved Hide resolved
Sources/Web3Core/KeystoreManager/BIP44.swift Outdated Show resolved Hide resolved
Sources/Web3Core/KeystoreManager/BIP44.swift Outdated Show resolved Hide resolved
Tests/web3swiftTests/localTests/BIP44Tests.swift Outdated Show resolved Hide resolved
Tests/web3swiftTests/localTests/BIP44Tests.swift Outdated Show resolved Hide resolved
Tests/web3swiftTests/localTests/BIP44Tests.swift Outdated Show resolved Hide resolved
Tests/web3swiftTests/localTests/BIP44Tests.swift Outdated Show resolved Hide resolved
@yaroslavyaroslav
Copy link
Collaborator

Just to mention: I'm actually waiting when @JeneaVranceanu issues would be applied to review it by myself.

Copy link
Collaborator

@yaroslavyaroslav yaroslavyaroslav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you for your effort!

@yaroslavyaroslav
Copy link
Collaborator

@JeneaVranceanu please take a look at the last state of this one, it would be great to include it into 3.1.0 release.

@albertopeam albertopeam requested review from yaroslavyaroslav and JeneaVranceanu and removed request for yaroslavyaroslav January 16, 2023 21:09
Copy link
Collaborator

@yaroslavyaroslav yaroslavyaroslav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for such a late one, haven't catch it in a prev review.

@JeneaVranceanu
Copy link
Collaborator

@JeneaVranceanu please take a look at the last state of this one, it would be great to include it into 3.1.0 release.

@yaroslavyaroslav On it right now.


public protocol BIP44 {
/**
Derive an ``HDNode`` based on the provided path. The function will throw ``BIP44Error.warning`` if it was invoked with throwOnWarning equal to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, wrap throwOnWarning into backticks so that it stands out when reading this as compiled documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll highlight such issues as I go.

public protocol BIP44 {
/**
Derive an ``HDNode`` based on the provided path. The function will throw ``BIP44Error.warning`` if it was invoked with throwOnWarning equal to
`true` and the root key doesn't have a previous child with at least one transaction. If it is invoked with throwOnError equal to `false` the child node will be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throwOnWarning wrap with backticks, please.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 12 as well.

- Throws: any error related to query the blockchain provider
- Returns: `true` if the address has at least one transaction, `false` otherwise
*/
func hasTransactions(address: String) async throws -> Bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the type of address to EthereumAddress.
This way we reduce one potential error - an invalid ethereum address.

The fact that we implement TransactionChecker and before we call hasTransactions function we check that the address is valid we do not provide safety for others if they want to implement a version of TransactionChecker themselves.

Any thoughts are welcome!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable :)

Sources/Web3Core/KeystoreManager/BIP44.swift Show resolved Hide resolved
struct Response: Codable {
let result: [Transaction]
}
struct Transaction: Codable {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add at least a field like hash to the Transaction struct?
Or maybe a swift doc to that struct explaining why it's empty to make sure we won't spend time in the future thinking too much about why it's empty. 🙂

I guess it is something like We are not interested in the contents of the transaction object but rather the availability of the transaction per see for the sake of counting the number of transactions for a specific account..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I had no time yesterday.

@JeneaVranceanu
Copy link
Collaborator

@albertopeam There is only one comment that really concerns me: #719 (comment)

The rest is actually looking very good.

@JeneaVranceanu JeneaVranceanu merged commit 50d0d83 into web3swift-team:develop Jan 19, 2023
@yaroslavyaroslav
Copy link
Collaborator

Sweet, now this was the last one within 3.1.0 I'll release it tomorrow or at monday. So please, folks, don't merge anything into dev right away. @JeneaVranceanu @janndriessen

@albertopeam albertopeam deleted the feature/add-bip-44 branch January 19, 2023 23:06
@albertopeam albertopeam mentioned this pull request Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants