-
Notifications
You must be signed in to change notification settings - Fork 754
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
Introduce Provider and Signer #51
Merged
Merged
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
BREAKING CHANGES: - new export structure to use Provider and Signer
Hey @janek26 , at first glance I really love this implementation. I think it strikes a great balance between standard defaults and also flexibility for developers. I will play around with it (hopefully this weekend) and let you know my feedback and merge it. Thanks! |
delaaxe
suggested changes
Nov 9, 2021
🎉 This PR is included in version 1.6.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
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.
The API of the starknet package got a bit out of hand with more and more utility and types.
closes #49
Inspired by
ethers
I introduced the concept of providers and signers, which can also get passed into more high level abstractions, such as theContract
class.Provider
To keep it simple (and because there's currently just one network
goerli-alpha3
) it also exports adefaultProvider
from the very top level. So you can still getting started by doingusing a provider (normally providers are read only, but as you can write to starknet without signing, providers can also write to starknet using
senderAddress = 0
) you can specify the network you wanna use, in preparation for main net launch.Signer
Signer can be used to intercept specific methods from a provider, like
addTransaction
to add a signature to every call. This is useful to interact with standard wallet implementations on starknet, like open zeppelin and argent.Signers can be provided by ie an extension, and their async methods can require user interactions with the extension before they resolve. A very simple Signer is shipped with starknet.js:
As a result this PR changes the way many functions are exported, therefore this is considered a BREAKING CHANGE and MAJOR version bump.