Skip to content

Major update for Signer and Account APIs #1513

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

denbite
Copy link
Contributor

@denbite denbite commented Apr 9, 2025

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • Commit messages follow the conventional commits spec
  • If this is a code change: I have written unit tests.
  • If this changes code in a published package: I have run pnpm changeset to create a changeset JSON document appropriate for this change.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

This PR brings a major update to the near-api-js library, introducing a more streamlined and developer-friendly interface. The core of this update is a new abstraction of Signer, which has been redesigned to focus solely on signing. It no longer requires knowledge of the broader account or network context, allowing for cleaner separation of concerns and easier integration across different environments.

Key Changes

TBD

Example Usage

I’ve opened a companion PR in the near-api-examples repo that demonstrates the new API in action

near-examples/near-api-examples#6

Copy link

changeset-bot bot commented Apr 9, 2025

🦋 Changeset detected

Latest commit: ffddebd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@near-js/wallet-account Major
@near-js/transactions Major
near-api-js Major
@near-js/providers Major
@near-js/accounts Major
@near-js/cookbook Major
@near-js/signers Major
@near-js/client Major
@near-js/types Major
@near-js/crypto Patch
@near-js/keystores Patch
@near-js/utils Patch
@near-js/biometric-ed25519 Patch
@near-js/keystores-browser Patch
@near-js/keystores-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

networkId: string,
provider: Provider,
signer: Signer,
jsvmAccountId: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove the jsvmAccountId from everywhere, as the jsvm is no longer relevant

const data = fs.readFileSync(HELLO_WASM_PATH);
await nearjs.accountCreator.masterAccount.createAndDeployContract(contractId, newPublicKey, data, HELLO_WASM_BALANCE);
// @ts-expect-error test input
contract = new Contract(nearjs.accountCreator.masterAccount, contractId, {
contract = new Contract(nearjs.connection, contractId, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does contract take a nearjs.connection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW❗
Development

Successfully merging this pull request may close these issues.

2 participants