diff --git a/docs/4.tools/near-api.md b/docs/4.tools/near-api.md
index df15d344b0..9056f58379 100644
--- a/docs/4.tools/near-api.md
+++ b/docs/4.tools/near-api.md
@@ -7,19 +7,22 @@ sidebar_label: NEAR API
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-## What is NEAR API
+The NEAR API is a set of libraries that allow you to interact with the NEAR blockchain. You can use it to create accounts, send tokens, deploy contracts, and more.
-There are differents libraries to interact with the NEAR blockchain. You can use it in the browser ([`near-api-js`](https://github.com/near/near-api-js)), or in server runtime ([`near-api-js`](https://github.com/near/near-api-js) for Node.js, [`near-jsonrpc-client`](https://github.com/near/near-jsonrpc-client-rs) for Rust and [`py-near`](https://github.com/pvolnov/py-near) for Python).
+The API is available in multiple languages, including:
+- JavaScript: [`near-api-js`](https://github.com/near/near-api-js)
+- Rust: [`near-jsonrpc-client`](https://github.com/near/near-jsonrpc-client-rs)
+- Python: [`py-near`](https://github.com/pvolnov/py-near)
-:::tip
-To quickly get started with integrating NEAR in a web browser, read our [Web Frontend integration](/build/web3-apps/integrate-contracts) article.
+For example, you could use [`near-api-js`](https://github.com/near/near-api-js) to create web applications or backend services written in node.js servers.
+
+:::tip Wallet Integration
+To allow users to login into your web application using a wallet you will need the `wallet-selector`. Read more in our [Web Frontend integration](/build/web3-apps/integrate-contracts) article
:::
---
-## Basics
-
-### Install {#install}
+## Install {#install}
@@ -28,6 +31,15 @@ To quickly get started with integrating NEAR in a web browser, read our [Web Fro
```bash
npm i --save near-api-js
```
+
+ :::tip Static HTML
+ If you are building a site without using `npm`, you can include the library directly in your HTML file through a CDN.
+
+ ```html
+
+ ```
+ :::
+
@@ -111,6 +123,21 @@ To quickly get started with integrating NEAR in a web browser, read our [Web Fro
If you sign transactions, you need to create a _Key Store_. In the browser, the LocalStorage KeyStore will be used once you ask your user to Sign In with the Wallet.
+
+
+
+ ```js
+ Hello
+ ```
+
+
+
+ ```js
+ World
+ ```
+
+
+
```js
/* Browser
Creates keyStore using private key in local storage
@@ -213,7 +240,7 @@ RPC providers can experience intermittent downtime, connectivity issues, or rate
## Account
-### Get Account {#get-account}
+### Instantiate Account {#load-account}
This will return an Account object for you to interact with.
@@ -227,9 +254,13 @@ This will return an Account object for you to interact with.
+:::warning
+In order to be able to use the account, its credentials must be stored in the [key store](#key-store)
+:::
+
-### Get Account Balance {#get-account-balance}
+### Get Balance {#get-account-balance}
@@ -245,11 +276,10 @@ This will return an Account object for you to interact with.
-### Get Account Details {#get-account-details}
+### Get Details {#get-account-details}
Returns information about an account, such as authorized apps.
-
@@ -264,7 +294,7 @@ Returns information about an account, such as authorized apps.
-### Get Account State {#get-account-state}
+### Get State {#get-account-state}
Get basic account information, such as amount of tokens the account has or the amount of storage it uses.
@@ -313,7 +343,7 @@ Get basic account information, such as amount of tokens the account has or the a
-### Create Account {#create-account}
+### Create Sub-Account {#create-account}
Create a sub-account.
@@ -330,7 +360,25 @@ Create a sub-account.
);
```
- For creating .near or .testnet accounts please refer to the [cookbook](https://github.com/near/near-api-js/tree/master/packages/cookbook/accounts).
+
+ Creating .near or .testnet accounts
+
+ In order to create .near or .testnet accounts, you need to make a function call to the top-level-domain (i.e. `near` or `testnet`), calling `create_account`:
+
+ ```js
+ return await creatorAccount.functionCall({
+ contractId: "testnet",
+ methodName: "create_account",
+ args: {
+ new_account_id: "new-account.testnet",
+ new_public_key: "ed25519:2ASWccunZMBSygADWG2pXuHM6jWdnzLzWFU6r7wtaHYt",
+ },
+ gas: "300000000000000",
+ attachedDeposit: utils.format.parseNearAmount(amount),
+ });
+ ```
+
+
@@ -643,7 +691,9 @@ Transfer NEAR tokens between accounts. This returns an object with transaction a
-### View
+### View Function
+
+View functions are read-only functions that don't change the state of the contract. We can call these functions without instantiating an account or a key store.
@@ -653,11 +703,12 @@ Transfer NEAR tokens between accounts. This returns an object with transaction a
const url = `https://rpc.${this.networkId}.near.org`;
const provider = new providers.JsonRpcProvider({ url });
+ const args = { greeting: 'hello' };
const response = await provider.query({
request_type: 'call_function',
- account_id: contractId,
- method_name: method,
+ account_id: 'hello.near-examples.testnet',
+ method_name: 'get_greeting',
args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),
finality: 'optimistic',
});
@@ -722,7 +773,7 @@ Transfer NEAR tokens between accounts. This returns an object with transaction a
-### Call
+### Call Function
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 62a8bb7bbf..1385eac31a 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -148,7 +148,7 @@ const config = {
type: 'html',
value: '
Essentials ',
},
- { label: 'NEAR API', to: '/tools/near-api-js/quick-reference' },
+ { label: 'NEAR API', to: '/tools/near-api' },
{ label: 'NEAR SDK', to: '/tools/sdk' },
{ label: 'NEAR CLI', to: '/tools/near-cli' },
{