-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rework RPC Access Keys, add new templates for all methods * Rework RPC - block-chunk * Rework RPC - contracts * Rework RPC - transactions * Rework RPC - gas, maintenance-windows, network, protocol * Update RPC - Access Keys examples * Update RPC - Contracts examples * Update RPC - Block-Chunk examples * Update RPC - Transactions, MW examples * Update RPC - Gas examples * Update RPC - Network, Protocol examples
- Loading branch information
1 parent
2445ee4
commit 6e9902d
Showing
192 changed files
with
7,449 additions
and
7,199 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
docs/5.api/rpc/access-keys/view-access-key-changes-all/error-schema-table.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<table className="custom-stripe"> | ||
<thead> | ||
<tr> | ||
<th>ERROR_TYPE<br /><code>error.name</code></th> | ||
<th>ERROR_CAUSE<br /><code>error.cause.name</code></th> | ||
<th>Status Code</th> | ||
<th>Reason</th> | ||
<th>Solution</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td rowspan="2">HANDLER_ERROR</td> | ||
<td>UNKNOWN_BLOCK</td> | ||
<td>200</td> | ||
<td> | ||
The requested block has not been produced yet or it has been | ||
garbage-collected (cleaned up to save space on the RPC node) | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Check that the requested block is legit</li> | ||
<li> | ||
If the block had been produced more than 5 epochs ago, try to send | ||
your request to{" "} | ||
<a | ||
href="https://near-nodes.io/intro/node-types#archival-node" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
an archival node | ||
</a> | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>NOT_SYNCED_YET</td> | ||
<td>200</td> | ||
<td> | ||
The node is still syncing and the requested block is not in the database | ||
yet | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Wait until the node finish syncing</li> | ||
<li>Send a request to a different node which is synced</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr className="stripe"> | ||
<td>REQUEST_VALIDATION_ERROR</td> | ||
<td>PARSE_ERROR</td> | ||
<td>400</td> | ||
<td> | ||
Passed arguments can't be parsed by JSON RPC server (missing arguments, | ||
wrong format, etc.) | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Check the arguments passed and pass the correct ones</li> | ||
<li> | ||
Check <code>error.cause.info</code> for more details | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>INTERNAL_ERROR</td> | ||
<td>INTERNAL_ERROR</td> | ||
<td>500</td> | ||
<td>Something went wrong with the node itself or overloaded</td> | ||
<td> | ||
<ul> | ||
<li>Try again later</li> | ||
<li>Send a request to a different node</li> | ||
<li> | ||
Check <code>error.cause.info</code> for more details | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
52 changes: 52 additions & 0 deletions
52
docs/5.api/rpc/access-keys/view-access-key-changes-all/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import { LantstoolLabel } from "@site/src/components/lantstool/LantstoolLabel/LantstoolLabel"; | ||
import { TryOutOnLantstool } from "@site/src/components/lantstool/TryOutOnLantstool"; | ||
import ErrorSchemaDescription from "../../general/error-schema-description.mdx"; | ||
import RequestJson from "./request-json.mdx"; | ||
import RequestJs from "./request-js.mdx"; | ||
import RequestBash from "./request-bash.mdx"; | ||
import ResponseJson from "./response-json.mdx"; | ||
import ErrorSchemaTable from "./error-schema-table.mdx"; | ||
|
||
## View access key changes (all) {#view-access-key-changes-all} | ||
|
||
Returns changes to <strong>all</strong> access keys of a specific block. | ||
Multiple accounts can be quereied by passing an array of `account_ids`. | ||
|
||
- method: `EXPERIMENTAL_changes` | ||
- params: | ||
- `changes_type`: `all_access_key_changes` | ||
- `account_ids`: `[ "example.testnet", "example2.testnet"]` | ||
- [`finality`](/api/rpc/setup#using-finality-param) _OR_ [`block_id`](/api/rpc/setup#using-block_id-param) | ||
|
||
Example: | ||
|
||
<Tabs groupId="code-tabs"> | ||
<TabItem value="json" label="JSON" default> | ||
<RequestJson /> | ||
</TabItem> | ||
<TabItem value="js" label="JavaScript"> | ||
<RequestJs /> | ||
</TabItem> | ||
<TabItem value="http" label="HTTPie"> | ||
<RequestBash /> | ||
</TabItem> | ||
<TabItem value="Lantstool" label={<LantstoolLabel />}> | ||
<TryOutOnLantstool path="docs/5.api/rpc/access-keys/get-changes-for-account-keys.json" /> | ||
</TabItem> | ||
</Tabs> | ||
|
||
<details> | ||
<summary>Example response: </summary> | ||
<ResponseJson /> | ||
</details> | ||
|
||
#### What Could Go Wrong?{#what-could-go-wrong-3} | ||
|
||
<ErrorSchemaDescription /> | ||
|
||
Here is the exhaustive list of the error variants that can be returned | ||
by `EXPERIMENTAL_changes` method: | ||
|
||
<ErrorSchemaTable /> |
11 changes: 11 additions & 0 deletions
11
docs/5.api/rpc/access-keys/view-access-key-changes-all/request-bash.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
```bash | ||
http POST https://archival-rpc.testnet.near.org \ | ||
jsonrpc=2.0 \ | ||
id=dontcare \ | ||
method=EXPERIMENTAL_changes \ | ||
params:='{ | ||
"changes_type": "all_access_key_changes", | ||
"account_ids": ["account.rpc-examples.testnet"], | ||
"block_id": 187309655 | ||
}' | ||
``` |
6 changes: 6 additions & 0 deletions
6
docs/5.api/rpc/access-keys/view-access-key-changes-all/request-js.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
```js | ||
const response = await near.connection.provider.accessKeyChanges( | ||
["account.rpc-examples.testnet"], | ||
{ blockId: 187309655 }, | ||
); | ||
``` |
12 changes: 12 additions & 0 deletions
12
docs/5.api/rpc/access-keys/view-access-key-changes-all/request-json.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
```json | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": "dontcare", | ||
"method": "EXPERIMENTAL_changes", | ||
"params": { | ||
"changes_type": "all_access_key_changes", | ||
"account_ids": ["account.rpc-examples.testnet"], | ||
"block_id": 187309655 | ||
} | ||
} | ||
``` |
53 changes: 53 additions & 0 deletions
53
docs/5.api/rpc/access-keys/view-access-key-changes-all/response-json.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
```json | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"block_hash": "6EDgS3zF9aoBMfdHqthQTQtudt7JzdLBbkTb6Jn4wfP9", | ||
"changes": [ | ||
{ | ||
"cause": { | ||
"receipt_hash": "9meU2ibDyJS2ga4se7j5knsWetKrXaw5qBpwrYgN1Qeh", | ||
"type": "receipt_processing" | ||
}, | ||
"change": { | ||
"access_key": { | ||
"nonce": 187309654000000, | ||
"permission": "FullAccess" | ||
}, | ||
"account_id": "account.rpc-examples.testnet", | ||
"public_key": "ed25519:vJBU18AtvePANmepMoY3rtV3wt1RHwqoktak82E4d2M" | ||
}, | ||
"type": "access_key_update" | ||
}, | ||
{ | ||
"cause": { | ||
"receipt_hash": "9meU2ibDyJS2ga4se7j5knsWetKrXaw5qBpwrYgN1Qeh", | ||
"type": "receipt_processing" | ||
}, | ||
"change": { | ||
"access_key": { | ||
"nonce": 187309654000000, | ||
"permission": { | ||
"FunctionCall": { | ||
"allowance": "150000000000000000000000", | ||
"method_names": [ | ||
"write_record", | ||
"get_record", | ||
"get_greeting", | ||
"__contract_abi", | ||
"contract_source_metadata" | ||
], | ||
"receiver_id": "contract.rpc-examples.testnet" | ||
} | ||
} | ||
}, | ||
"account_id": "account.rpc-examples.testnet", | ||
"public_key": "ed25519:EddTahJwZpJjYPPmat7DBm1m2vdrFBzVv7e3T4hzkENd" | ||
}, | ||
"type": "access_key_update" | ||
} | ||
] | ||
}, | ||
"id": "dontcare" | ||
} | ||
``` |
84 changes: 84 additions & 0 deletions
84
docs/5.api/rpc/access-keys/view-access-key-changes-single/error-schema-table.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<table className="custom-stripe"> | ||
<thead> | ||
<tr> | ||
<th>ERROR_TYPE<br /><code>error.name</code></th> | ||
<th>ERROR_CAUSE<br /><code>error.cause.name</code></th> | ||
<th>Status Code</th> | ||
<th>Reason</th> | ||
<th>Solution</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td rowspan="2">HANDLER_ERROR</td> | ||
<td>UNKNOWN_BLOCK</td> | ||
<td>200</td> | ||
<td> | ||
The requested block has not been produced yet or it has been | ||
garbage-collected (cleaned up to save space on the RPC node) | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Check that the requested block is legit</li> | ||
<li> | ||
If the block had been produced more than 5 epochs ago, try to send | ||
your request to{" "} | ||
<a | ||
href="https://near-nodes.io/intro/node-types#archival-node" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
an archival node | ||
</a> | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>NOT_SYNCED_YET</td> | ||
<td>200</td> | ||
<td> | ||
The node is still syncing and the requested block is not in the database | ||
yet | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Wait until the node finish syncing</li> | ||
<li>Send a request to a different node which is synced</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr className="stripe"> | ||
<td>REQUEST_VALIDATION_ERROR</td> | ||
<td>PARSE_ERROR</td> | ||
<td>400</td> | ||
<td> | ||
Passed arguments can't be parsed by JSON RPC server (missing arguments, | ||
wrong format, etc.) | ||
</td> | ||
<td> | ||
<ul> | ||
<li>Check the arguments passed and pass the correct ones</li> | ||
<li> | ||
Check <code>error.cause.info</code> for more details | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>INTERNAL_ERROR</td> | ||
<td>INTERNAL_ERROR</td> | ||
<td>500</td> | ||
<td>Something went wrong with the node itself or overloaded</td> | ||
<td> | ||
<ul> | ||
<li>Try again later</li> | ||
<li>Send a request to a different node</li> | ||
<li> | ||
Check <code>error.cause.info</code> for more details | ||
</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
52 changes: 52 additions & 0 deletions
52
docs/5.api/rpc/access-keys/view-access-key-changes-single/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import { LantstoolLabel } from "@site/src/components/lantstool/LantstoolLabel/LantstoolLabel"; | ||
import { TryOutOnLantstool } from "@site/src/components/lantstool/TryOutOnLantstool"; | ||
import ErrorSchemaDescription from "../../general/error-schema-description.mdx"; | ||
import RequestJson from "./request-json.mdx"; | ||
import RequestJs from "./request-js.mdx"; | ||
import RequestBash from "./request-bash.mdx"; | ||
import ResponseJson from "./response-json.mdx"; | ||
import ErrorSchemaTable from "./error-schema-table.mdx"; | ||
|
||
## View access key changes (single) {#view-access-key-changes-single} | ||
|
||
Returns individual access key changes in a specific block. You can query multiple | ||
keys by passing an array of objects containing the `account_id` and `public_key`. | ||
|
||
- method: `EXPERIMENTAL_changes` | ||
- params: | ||
- `changes_type`: `single_access_key_changes` | ||
- `keys`: `[{ account_id, public_key }]` | ||
- [`finality`](/api/rpc/setup#using-finality-param) _OR_ [`block_id`](/api/rpc/setup#using-block_id-param) | ||
|
||
Example: | ||
|
||
<Tabs groupId="code-tabs"> | ||
<TabItem value="json" label="JSON" default> | ||
<RequestJson /> | ||
</TabItem> | ||
<TabItem value="js" label="JavaScript"> | ||
<RequestJs /> | ||
</TabItem> | ||
<TabItem value="http" label="HTTPie"> | ||
<RequestBash /> | ||
</TabItem> | ||
<TabItem value="Lantstool" label={<LantstoolLabel />}> | ||
<TryOutOnLantstool path="docs/5.api/rpc/access-keys/get-changes-for-account-key.json" /> | ||
</TabItem> | ||
</Tabs> | ||
|
||
<details> | ||
<summary>Example response: </summary> | ||
<ResponseJson /> | ||
</details> | ||
|
||
#### What Could Go Wrong?{#what-could-go-wrong-2} | ||
|
||
<ErrorSchemaDescription /> | ||
|
||
Here is the exhaustive list of the error variants that can be returned | ||
by `EXPERIMENTAL_changes_in_block` method: | ||
|
||
<ErrorSchemaTable /> |
16 changes: 16 additions & 0 deletions
16
docs/5.api/rpc/access-keys/view-access-key-changes-single/request-bash.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```bash | ||
http POST https://archival-rpc.testnet.near.org \ | ||
jsonrpc=2.0 \ | ||
id=dontcare \ | ||
method=EXPERIMENTAL_changes \ | ||
params:='{ | ||
"changes_type": "single_access_key_changes", | ||
"keys": [ | ||
{ | ||
"account_id": "account.rpc-examples.testnet", | ||
"public_key": "ed25519:EddTahJwZpJjYPPmat7DBm1m2vdrFBzVv7e3T4hzkENd" | ||
} | ||
], | ||
"block_id": "6RWmTYhXCzjMjoY3Mz1rfFcnBm8E6XeDDbFEPUA4sv1w" | ||
}' | ||
``` |
11 changes: 11 additions & 0 deletions
11
docs/5.api/rpc/access-keys/view-access-key-changes-single/request-js.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
```js | ||
const response = await near.connection.provider.singleAccessKeyChanges( | ||
[ | ||
{ | ||
account_id: "account.rpc-examples.testnet", | ||
public_key: "ed25519:EddTahJwZpJjYPPmat7DBm1m2vdrFBzVv7e3T4hzkENd", | ||
}, | ||
], | ||
{ blockId: "6RWmTYhXCzjMjoY3Mz1rfFcnBm8E6XeDDbFEPUA4sv1w" }, | ||
); | ||
``` |
Oops, something went wrong.