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

Add convenience init for Web3HttpProvider #717

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Sources/web3swift/Web3/Web3+HttpProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ public class Web3HttpProvider: Web3Provider {
}
attachedKeystoreManager = manager
}

public init(
url: URL,
network: Networks,
keystoreManager: KeystoreManager? = nil
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These style doesn't match with all the other code in our project, please format it in more swift way, like init attributes should be in one line and open curly brackets should follow them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done e893cb3

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yaroslavyaroslav For large long functions and inits I'd break them into multiple lines.
E.g. for the init? of Web3HttpProvider:

public init?(_ httpProviderURL: URL,
             network net: Networks? = nil,
             keystoreManager: KeystoreManager? = nil) async {
                 ...
             }

instead of what we currently have.

@rinat-enikeev Nothing to change for you in this PR, just raising commenting on this topic.

self.url = url
self.network = network
self.attachedKeystoreManager = keystoreManager
}
}