Skip to content

feat: extend Account constructor to accept RPC URL string in addition to Provider#1794

Merged
gagdiez merged 3 commits into
pre-release/v7from
v7/allow-string-provider-arg
Jan 16, 2026
Merged

feat: extend Account constructor to accept RPC URL string in addition to Provider#1794
gagdiez merged 3 commits into
pre-release/v7from
v7/allow-string-provider-arg

Conversation

@denbite

@denbite denbite commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

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 extends the Account constructor to accept an RPC URL string in addition to a Provider, making account instantiation simpler and more ergonomic.

New supported usage:

new Account('user.near', 'https://rpc.testnet.near.org');

Previously, users had to always manually create a provider:

const provider = new JsonRpcProvider({ url: 'https://rpc.testnet.near.org' });
new Account('user.near', provider);

Test Plan

Related issues/PRs

@changeset-bot

changeset-bot Bot commented Jan 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f15ba44

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

This PR includes changesets to release 1 package
Name Type
near-api-js Minor

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

@gagdiez gagdiez merged commit 54a0c13 into pre-release/v7 Jan 16, 2026
3 checks passed
@gagdiez gagdiez deleted the v7/allow-string-provider-arg branch January 16, 2026 13:45
@github-project-automation github-project-automation Bot moved this from NEW❗ to Shipped 🚀 in DevTools Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Shipped 🚀

Development

Successfully merging this pull request may close these issues.

3 participants