near / near-api-js

JavaScript library to interact with NEAR Protocol via RPC API
https://near.github.io/near-api-js
MIT License
388 stars 240 forks source link

@near-js/client package #1351

Open andy-haynes opened 1 month ago

andy-haynes commented 1 month ago

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 and transactions), 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

changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

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.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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