13 Commits

Author SHA1 Message Date
Aaron Cox 43c1da1628 Regeneration all mock data
A `headers` value is now added to fetch, which the mock data wasn't expecting and causing the need for it to be recreated.
2024-08-13 11:13:58 -07:00
Aaron Cox 7a1422e932 Added support for context_free_actions and context_free_data 2024-01-25 13:37:02 -08:00
Daniel Fugere d1c2934945 enhancement: added account() method on session (#90) 2024-01-22 17:51:09 -08:00
Aaron Cox e84bf64096 1.2.1 (#87)
* Adding return values to response

* Rewriting/regenerating tests

* Version 1.2.0

* Detect and pass index to web render for default selection

* Renamed return value interface

* Updating dependencies

* Version 1.2.1-rc1

* Version 1.2.1
2023-11-30 12:13:39 -08:00
Aaron Cox 4f017b0016 Updating dev dependencies 2023-11-09 16:50:55 -08:00
Aaron Cox ed329c2500 1.1.0 Release (#75)
* Added MOCK_DIR to coverage build

* Allow passing a `ChainDefinition` to login as `chain`

* Remove broken browser test build

* Allow passing in Contract instances for ABI caching

* Version 1.1.0-rc1

* Version 1.1.0-rc2

* Updating dependencies

* Updated tests for compressed transactions

* Added package resolution for next build

* Moved ABICache mechanisms out to its own function

Also implemented caching from embedded Action objects from new wharfkit/antelope release.

* Updating dependencies and tests for ABI caching

* Each `WalletPlugin` may optionally return an `IdentityProof`

Related to #72

* Allow calling `restore` with a `ChainDefinition`

Fixes #71

* Updating Antelope library

* New test account

* New `setAsDefault` parameter during login

Allows the developer during a `login` call to specify whether or not this account should be the new default for `restore`. Defaults to true.

* Support for Account Creation Plugins (#84)

* chore: added account-creation plugins

* fix: getting createAccount method working

* fix: fixed prompts

* fix: adding account creation plugins to context

* fix: adding account creation method to ui interface

* chore: added onAccountCreateComplete

* Ran `make format`

* Linting

* Require a name for creation services

* Mocked account creation methods in tests

* Linting

* Removed selected plugin from context

* Swapped chain to Checksum256Type

* Removed chains

* Linting

* Removed chains from options

This adds a lot of complexity for very little gain in the account creation flow.

* Reworked createAccount flow

* Version 1.1.0-rc3

* Allow developer to override chain/plugin for Account Creation

* Version 1.1.0-rc4

* Filter chains based on plugin capabilities, if set

---------

Co-authored-by: Aaron Cox <aaron@greymass.com>

* Updating dependencies for 1.1.0

* Added missing mock data

---------

Co-authored-by: Daniel Fugere <danielfugere28@gmail.com>
2023-11-09 16:48:52 -08:00
Aaron Cox 679d30cbd3 v1.0.0 (#5)
* The `ui` option is now required for the SessionKit

* Split SessionKit initialization to both "args" and "options"

* Move `onSignComplete` to after all signing ops finish

* Allow restoring without serialized session

The restore method can now be used by just providing an actor, permission, and chainId - and will pull the session data out of the storage adapter to restore.

* Track and allow restoring a default account per-chain

Each individual chain now tracks a `default` value within its serialized storage, and the `restore()` function can now accept just a chain ID to restore the default account for that chain.

* Reapplied 4faab919a3154dc875279e54c3baf9448de7eefa

* Version 1.0.0-beta1

* Moved all mock data to its own repository

* Updating @wharfkit/mock-data and MOCK_DIR

* Fixing ci-test

* Updating @wharfkit/mock-data

* Allow manually passing in ABIDef for use in Sessions

* Version 1.0.0-beta2

* Version 1.0.0-beta3

* Renamed AbiProvider to ABICache since it's an extension of ESR

* Better defined ABICacheInterface

* Version 1.0.0-beta4

* Prevent uneeded get_info calls when resolving

* Linting of tests

* Adding tests for placeholder resolution

* Adding test data for placeholder resolution

* Unused test cleanup

* Linting

* Removing unused import

* Version 1.0.0-beta5

* Replacing @greymass/eosio with @wharfkit/antelope

* Version 1.0.0-beta6

* Cleanup of greymass/eosio continued

* Version 1.0.0-beta7

* Fixed badge path

* Removed internal ABICache and using @wharfkit/abicache

* Updating contract kit and abicache to optimize ABI loading

* Remove requirement of prefix on storage

* Change `appName` from Name to a string

Resolves #68

Still accept `NameType` as the parameter to maintain reverse compatibility with older versions and other app formats.

* Migrated data to wharfkit/common

* Adding test to ensure common chains can be passed

* Updating wharfkit/common

* Switching to `import type` for some @wharfkit/common elements

* Added package description

* Update README.md

* Updated @wharfkit/common

* Version 1.0.0-beta8

* Updating ABICache and Contract Kit

* Updating ESR library

* Version 1.0.0-beta9

* Dependency cleanup

* Updating private key plugin

* Version 1.0.0
2023-07-31 13:30:22 -07:00
Aaron Cox 8c634684f0 0.4.1 (#51)
* linting

* Allow using SerializedSession during the logout call

Resolves #49

* Test cleanup

* The `storage` parameter is now optional and has a default

Resolves #40

* Calling of `beforeLogin` and `afterLogin` hooks during `login` call

* Persist the session before calling `onLoginComplete`.

* Initial sign method prototype

* removed unused method import

* Manually craft a ResolvedSigningRequest to bypass ABI needs

* Moved test for sign

* Create Request independently

* Simplify call

* Add `setAbi` to the ABICache and a number of tests

* Fixing tests

* Import cleanup

* Catch and display login errors in the UI

* Switching `WalletPlugin` response type

A `ResolvedSigningRequest` is now required from a `WalletPlugin` if it modifies the transaction.

* Added docblock for `sign` method

* Renamed `sign` to `signTransaction` to be specific.

* The `afterSign` and `afterBroadcast` hooks now accept a `TransactResult` instead of a `SigningRequest`

* Fixed test
2023-05-19 21:11:18 -04:00
Aaron Cox c13fc2e32f 0.3.0 - Release (#27)
* 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>
2023-03-03 12:19:26 -05:00
Aaron Cox 9d946e49fe Rework fetch passing (#11)
* Updated TEST_FILES to ensure it only executes tests

* Reworked how fetch is initialized for sessions/kits

* Added test account generation script

* Fixed table markdown

* Readded return type

* Adding initial code for resource-provider plugin example

* Session Kit now only accepts a fetch instance

Instead of accepting an APIClient or FetchProvider to provide modified HTTP requests, the classes now only accept fetch itself.

* Replacing the MockFetchProvider with a mock Fetch

* Updating all tests to now use the new Fetch implementation

* Updated account setup helper to pass fetch directly

* Remove the test mock timeout - the APIs are occasionally slow

* Added two more test accounts

* Fixed account setup script

* Reworked tests to use new wharfkittest accounts on Jungle4

* Added resource provider test case
2022-12-08 14:09:06 -05:00
Aaron Cox 3166316430 Broadcast (#10)
* Updating dependencies

* Allow specifying broadcast/allowModify on session instantiation

* Swapped hook processing to for...of loops

* Initial broadcast implementation using send_transaction

* Use the resolved transaction for signing instead of raw

* Implemented tests for broadcasting + reworked for Jungle 4

* changed callback to `hook` for consistency

* Fixed partial comment
2022-12-05 12:33:55 -05:00
Aaron Cox 912ee23a07 Rework transact call for plugins/hooks. (#7)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* First pass on transactPlugins

* Renamed interfaces

* Organized types

* Removed Abstract classes and SessionContext

* Another reorganization and simplification

* Added optional watch mode for mocha

* Removed unused import

* Wallet plugin no longer returns self.

* Added AbstractWalletPlugin

* Added `transactPluginsOptions` to optionally pass data to plugins from various points.

* Allow passing a client during login

* Removed diagram (needs updating)

* Added TODO for some incomplete tests

* Allow passing fetch directly into a manually created session

* Force test to use mockClient, but focus the example on normal use.

* reordered imports

* Collapsed hooks from a class to a function
2022-11-22 21:26:03 -05:00
Aaron Cox bd981104ab Initial scaffolding and base tests (#4)
* Initial setup for Session Kit

* Fixing build errors

* Path fixes

* Had to change paths for docs build

* Testing Mermaid

* Fixed description

* More mermaid testing

* Removed animal examples

* Allow passing in fetch to the sessionKit and client to a session

* Specify transaction hooks

* Converted transact method to work in SigningRequest payloads

* Allow usage of strings for Private Key wallet

* Pass request as an object instead of destructuring.

* Allow plain objects that match the ChainDefinition type.

* Full untyped example

* Added support for SigningRequest payloads in transact

* Added missing field to TransactArgs

* Reworked how the transact method will process hooks.

* Upgrading transact call to support JSON representations of transactions

* Starting implementation of hooks + tests

* Temporarily commented out unused classes.

* Moved SessionContext into types

* Adding new TransactContext for each independent transaction

* Changed to a real account name for testing purposes.

* Added test case for Resource Provider hook

* Removed unused classes from test

* File structure reorg for tests

* Better detection of test files

* Added WalletPluginPrivateKey test

* Allowing string types for chain and permission level on login options

* Use Object instead of generic internally

* Adding more test coverage for kits

* Moved handles tests into suite

* Reworked hook types

* Improved tests and coverage.

* Removed unused imports

* Build/copy coverage report into pages build

* Reworked test imports/pathing

* Changed imports to use @greymass/eosio

* Changed test running build process

* cleanup externals

* Direct importing

* Swap to named to prevent warnings

* make lib when publishing pages

* Updating eosio-signing-request

* Modified Transact to resolve and return resolved transactions

* Added tests to check transact response data
2022-11-01 19:47:34 -04:00