Skip to content

Commit 158f40a

Browse files
authored
chore: merge pre-release/v7 to main
the new `near-api-js v7.0.0` introduces multiple improvements to the library: ## No more sub-packages For starters, `near-api-js` is now again a single library instead of 10+ subpackages, this means that now we can import everything directly from `near-api-js` instead of adding multiple `@near-js/<something>` ## General Improvements - All functions now have a consistent interface, taking only `object` parameters - Renamed the `actionsCreator` to simply `actions` and divided `actionsCreator.addKey` action into `actions.addFullAccessKey` and `actions.addFunctionCallKey` - `v6` had `utils.parseNear` and `utils.formatNear` to convert between units, we renamed them to `nearToYocto` and `yoctoToNear` and export them directly from the top package - `v7` is now purely ESM - During `v6` we deprecated multiple functions that were either no-longer needed or where renamed, they are all now gone in `v7` - `v7` has only 7 dependencies, pinned to specific versions to reduce attack surface - `Typed Contracts` are now the default type of `Contract`, being able to create typed objects from `abi` files ## Better Error handling In `v6` users needed to match strings in order o handle errors, with `v7` we export multiple classes to help identify is an error `isinstanceof` ## Automatically Handle Nonce Collisions `Accounts` will now automatically handle `nonce collisions`, simply re-trying the transaction with a new `nonce` ## New Signers - Signers can now be defined by simply implementing the `signBytes` method - We introduced a new type of `Signer` called `MultiKeySigner` that rotates through multiple keys in order to sign transactions ## New Subpaths - `nep413`: `v7` now exposes methods to easily sign and verify `nep413` messages - `tokens`:`v7` now exposes classes to handle `FT` and `NFT`, allowing to easily transfer tokens by doing `account.transfer(tokens.USDT, tokens.USDT.toUnits(1))` - `seed-phrase`: `v7` exposes methods to create mnemonic phrases as well as to transform `mnemonic` keys into `keypairs`
2 parents 345de7c + 047d896 commit 158f40a

483 files changed

Lines changed: 21108 additions & 28900 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/all-rockets-attend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": major
3+
---
4+
5+
Update `parseNearAmount` to only accept either a numeric string, or actual number, and not undefined, as well as throw error rather than silently return `null`

.changeset/better-forks-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": patch
3+
---
4+
5+
Remove redundant `null` argument from `Provider.viewValidators` method

.changeset/better-results-watch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": major
3+
---
4+
5+
Rename stable `viewValidatorsV2` function back to `viewValidators`

.changeset/big-falcons-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": patch
3+
---
4+
5+
Update dependencies

.changeset/bold-schools-wear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": patch
3+
---
4+
5+
Add default `EXECUTED_OPTIMISTIC` value to `waitUntil` argument of `viewTransactionStatus` and `viewTransactionStatusWithReceipts`

.changeset/brave-files-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": minor
3+
---
4+
5+
Introduce many specific errors based on generated response types from OpenAPI spec and which are thrown when calling `Provider.sendJsonRpc` method

.changeset/clean-bags-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": minor
3+
---
4+
5+
Added a new multi-key signer which handles multiples keys and transparently rotates them as users ask to sign transactions

.changeset/clean-radios-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": patch
3+
---
4+
5+
feat: replace ESLint with Biome for linting

.changeset/clever-feet-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"near-api-js": minor
3+
---
4+
5+
Add `nep413` module that implements `signMessage` and `verifyMessage` functions

.changeset/config.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3-
"changelog": ["@changesets/changelog-github", { "repo": "near/near-api-js" }],
4-
"commit": false,
5-
"fixed": [["@near-js/*"]],
6-
"linked": [],
7-
"access": "public",
8-
"baseBranch": "master",
9-
"updateInternalDependencies": "patch",
10-
"bumpVersionsWithWorkspaceProtocolOnly": true,
11-
"ignore": []
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "near/near-api-js" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"bumpVersionsWithWorkspaceProtocolOnly": true,
11+
"ignore": []
1212
}

0 commit comments

Comments
 (0)