Open andy-haynes opened 1 month ago
Latest commit: 1c296d1ae0a5d7bbdd1097b615d102fffc25a1c3
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
readme
This PR contains an outline for a proposed implementation for an API providing high-level methods for interacting with NAJ objects. The ultimate goal is to provide simple methods which map directly to clear behavior (examples). These methods in turn can be easily wrapped by frontend libraries to tie the behavior to application lifecycle.
The implementation is backed primarily by a
NearClient
class to reduce the number of required dependencies and provide an intuitive API for common operations. Client instances are easily configured for viewing and/or signing and provide helpful methods with clear, succinct parameters. This would also be exported from the package to aid in more complex use cases.This is very much a WIP and contains some duplicated code (in particular some tightly coupled logic in
accounts
andtransactions
), but is still useful as a proof of concept for a simple composition layer over@near-js
packages. It can easily be supplemented with a caching strategy and extended for use in frontend frameworks (i.e. hooks).cc @mpeterdev @thisisjoshford