-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Split arguments and options for Session constructor #30
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
This is a breaking change from 0.2.x to 0.3.x. This change moves the required parameters into the SessionArgs as the first value of the constructor, and then moves all optional values as SessionArgs into the 2nd parameter of the constructor. The goal is to make it easier to understand which values are required and which values are optional when manually creating a Session.
aaroncox
added a commit
that referenced
this pull request
Mar 3, 2023
* Generalized the abiProvider on a Session/TransactContext It was very specifically acting as an ABICache instance, but the session kit shouldn't need it to be a cache. The developer establishing the session should be able to make that decision on how ABIs are fetched. * Basic UI interface for the browser implementation to use * Fixed bundle build * Resolved issue where LoginOptions weren't setting the permission * Added onTransact and onTransactResult as UI event triggers * Added bundled build for unpkg * Removed unpkg build steps * Added WalletPluginConfig and WalletPluginMetadata These interfaces are used to help dictate how the WalletPlugin behaves and what is shown in the UserInterface. * Added appName options to the Session * Added istanbul ignores to lifted code from ESR * Major rewrite of the login method and its interactions with the UI * Remove failing test against fetch * Added cjs build back in * Adjusting types and modifiers for plugin implementations * Migrated WalletPluginPrivateKey to standalone repo * Formatting * Added rollup-plugin-cleanup to clear comments from build Decided against a terser since we still want code to be readable for developers who are debugging, but the comments aren't exactly needed. Developers in their own applications should handle tersing the code in their production builds. * Pass on adding more comments for typedoc * Split arguments and options for Session constructor (#30) This change moves the required parameters into the SessionArgs as the first value of the constructor, and then moves all optional values as SessionArgs into the 2nd parameter of the constructor. The goal is to make it easier to understand which values are required and which values are optional when manually creating a Session. * Forcing everything up to 0.6.8 * Following new constructor patterns 1st - subject matter of the call (if specific) 2nd - context (if exists) 3rd - options (if exists) * Removed context from options * Adding chain to TransactContext * Cleanup * Very generic prompt code * Upgraded privatekey plugin for tests * UI: Added countdown element type and made body optional * Reworked login to match UI selections * Mock the onError event * Added supportedChains parameter * SessionKit now optionally accepts `allowModify` * [BREAKING] Changed WalletPlugin.sign() response format The response from the `sign` method of the WalletPlugin has been modified from a Signature to an object. This allows the WalletPlugin to modify the transaction as long as the `allowModify` flag allows it. * Added SessionStorage interface and BrowserLocalStorage implementation * Wrapping the transact call in a try/catch block for error handling * Fixing unit tests w/ dep upgrade * Formatting for typedoc * Initial storage and restore methods * Test cleanup * Split storage into its own file * Split login into its own file * Split wallet into its own file * Split ui into its own file * Reworked walletPlugin serialization Extending the abstract class now gives the individual WalletPlugin the serialization method. * Updating wallet-plugin-privatekey for tests * Reworked login user interaction flow The previous iteration of the user interaction flow did not allow for flexibility in changing menus. The interface was unable to go back and forth between the wallet, chain, and permission selection steps. This delegates all of those events to the user interface itself and all values are returned at once to pass to the selected wallet plugin. * Updated dev dependencies * Removed default UserInterface and UserInterfaceHeadless The requirement to have a `ui` element has been removed, and all attempts to use the `ui` are now conditional based on it existing. The `login` method of the SessionKit now checks to make sure it exists before attempting to log a user in. * Added restore, logout, persistSession, and getSessions to Kit * Automatically flip the `allowModify` flag to false after the first signature This will prevent either the wallet or other plugins from modifying the transaction and invalidating any future signatures. * Updated core * Set broadcast to false on all ESR payloads * Updating test data since ESR payload was modified. * Always resolve requests to the chain for this session. * Reworking wallet serialization and data storage * Adding new accounts and reworking for new session constructor * Updating private key plugin for tests * Utilize cancelable promises for the UI prompt call * fix: making UI login response fields optional * Add the createRequest method to the TransactContext * Fixed mock context * Set a flag on Cancelable promises to allow them to be silent * Adding appName to login context * Allow void responses from TransactHook calls * Pass TransactResult to the afterBroadcast hooks * Add an optional ExplorerDefinition for each ChainDefinition * Adding close element and renaming button to link * Filter out unknown wallets from getSessions * Add appName to TransactContext * Adding base esrOptions to LoginContext * Reworked events and added a few additional points to interact * Removed the remaining status calls * Moved all variable/flag definitions to the top of the transact call * Localization support for UserInterface implementations. * Allow passing a WalletPlugin ID to Login to select automatically * Add onSign events to transact flow * Allow translations from a WalletPlugin * Create a type for the translate function on the UI * Version 0.3.0 --------- Co-authored-by: dafuga <danielfugere28@gmail.com>
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.
This is a breaking change from 0.2.x to 0.3.x.
This change moves the required parameters into the SessionArgs as the first value of the constructor, and then moves all optional values as SessionOptions into the 2nd parameter of the constructor.
The goal is to make it easier to understand which values are required and which values are optional when manually creating a Session.