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

Split arguments and options for Session constructor #30

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

aaroncox
Copy link
Member

@aaroncox aaroncox commented Feb 3, 2023

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.

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 aaroncox merged commit 83d319d into ui Feb 7, 2023
@aaroncox aaroncox deleted the refactor-session-constructor branch February 21, 2023 17:26
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant