Commit 158f40a
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`483 files changed
Lines changed: 21108 additions & 28900 deletions
File tree
- .changeset
- .devcontainer
- .github/workflows
- e2e
- contracts/guestbook
- tests
- import
- packages
- accounts
- src
- local-view-execution
- test
- biometric-ed25519
- src
- test
- client
- src
- interfaces
- signing
- transactions
- composers
- cookbook
- accounts
- access-keys
- api-keys
- transactions
- utils
- wasm-files
- crypto
- src
- iframe-rpc
- src
- keystores-browser
- src
- test
- keystores-node
- src
- test
- keystores
- src
- test
- near-api-js
- src
- key_stores
- providers
- utils
- test
- providers
- src
- test
- signers
- src
- tokens
- src
- mainnet
- testnet
- transactions
- src
- tsconfig
- types
- src
- utils
- src
- errors
- logger
- test
- src
- accounts
- crypto
- nep413
- providers
- errors
- rpc-errors
- rpc
- seed-phrase
- signers
- tokens
- ft
- mainnet
- mt
- nft
- testnet
- transactions
- types
- provider
- units
- utils
- test
- contracts/guestbook
- integration
- unit
- accounts
- wasm
- crypto
- providers
- seed-phrase
- signers
- tokens
- transactions
- data
- units
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
0 commit comments