Skip to content

Commit f31c504

Browse files
authored
Merge pull request #3040 from XRPLF/add-non-admin-feature-rpc
Add non-admin feature RPC
2 parents 7d39cb3 + d905b9c commit f31c504

File tree

5 files changed

+154
-1
lines changed

5 files changed

+154
-1
lines changed

docs/references/http-websocket-apis/admin-api-methods/status-and-debugging-methods/feature.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The `feature` command returns information about [amendments](../../../../concept
1414

1515
You can use the `feature` command to configure the server to vote against or in favor of an amendment. This change persists even if you restart the server. {% badge href="https://github.com/XRPLF/rippled/releases/tag/1.7.0" %}Updated in: rippled 1.7.0{% /badge %}
1616

17-
_The `feature` method is an [admin method](../index.md) that cannot be run by unprivileged users._
17+
_The `feature` method documented on this page is an [admin method](../index.md). For the non-admin version, see the [`feature` public API method](../../public-api-methods/server-info-methods/feature.md)._
1818

1919
### Request Format
2020
An example of the request format:

docs/references/http-websocket-apis/public-api-methods/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Use these methods to enable the server to push updates to your client when vario
8989
Use these methods to retrieve information about the current state of the `rippled` server.
9090

9191
* **[`fee`](server-info-methods/fee.md)** - Get information about transaction cost.
92+
* **[`feature`](server-info-methods/feature.md)** - Returns information about amendments this server knows about.
9293
* **[`server_info`](server-info-methods/server_info.md)** - Retrieve status of the server in human-readable format.
9394
* **[`server_state`](server-info-methods/server_state.md)** - Retrieve status of the server in machine-readable format.
9495
* **[`server_definitions`](server-info-methods/server_definitions.md)** - Retrieve a list of types and fields used for the XRPL's canonical binary format.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
html: feature.html
3+
parent: server-info-methods.html
4+
seo:
5+
description: Get information about protocol amendments.
6+
labels:
7+
- Blockchain
8+
- Core Server
9+
---
10+
11+
# feature
12+
13+
[[Source]](https://github.com/XRPLF/rippled/blob/master/src/xrpld/rpc/handlers/Feature1.cpp "Source")<br/>
14+
15+
The `feature` command returns information about [amendments](../../../../concepts/networks-and-servers/amendments.md) this server knows about, including whether they are enabled and if the server knows how to apply the amendments.
16+
17+
This is the non-admin version of the [`feature` admin command](../../admin-api-methods/status-and-debugging-methods/feature.md). It follows the same formatting as the _admin_ command, but hides potentially sensitive data.
18+
19+
{% badge href="https://github.com/XRPLF/rippled/releases/tag/2.2.0" %}New in: rippled 2.2.0{% /badge %}
20+
21+
## Request Format
22+
23+
An example of the request format:
24+
25+
{% tabs %}
26+
27+
{% tab label="WebSocket" %}
28+
```json
29+
{
30+
"command": "feature",
31+
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373"
32+
}
33+
```
34+
{% /tab %}
35+
36+
{% tab label="JSON-RPC" %}
37+
```json
38+
{
39+
"method": "feature",
40+
"params": [
41+
{
42+
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373"
43+
}
44+
]
45+
}
46+
```
47+
{% /tab %}
48+
49+
{% tab label="Commandline" %}
50+
```sh
51+
#Syntax: feature [<feature_id>]
52+
rippled feature 4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373
53+
```
54+
{% /tab %}
55+
56+
{% /tabs %}
57+
58+
{% try-it method="feature" /%}
59+
60+
The request includes the following parameters:
61+
62+
| `Field` | Type | Description |
63+
|:----------|:--------|:-------------------------------------------------------|
64+
| `feature` | String | _(Optional)_ The unique ID of an amendment, as hexadecimal; or the short name of the amendment. If provided, limits the response to one amendment. Otherwise, the response lists all amendments. |
65+
66+
## Response Format
67+
68+
An example of a successful response:
69+
70+
{% tabs %}
71+
72+
{% tab label="WebSocket" %}
73+
```json
74+
{
75+
"result": {
76+
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
77+
"enabled": false,
78+
"name": "MultiSign",
79+
"supported": true
80+
}
81+
},
82+
"status": "success",
83+
"type": "response"
84+
}
85+
```
86+
{% /tab %}
87+
88+
{% tab label="JSON-RPC" %}
89+
```json
90+
200 OK
91+
92+
{
93+
"result": {
94+
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
95+
"enabled": false,
96+
"name": "MultiSign",
97+
"supported": true
98+
},
99+
"status": "success"
100+
}
101+
}
102+
```
103+
{% /tab %}
104+
105+
{% tab label="Commandline" %}
106+
```json
107+
Loading: "/etc/rippled.cfg"
108+
Connecting to 127.0.0.1:5005
109+
110+
{
111+
"result": {
112+
"4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373": {
113+
"enabled": false,
114+
"name": "MultiSign",
115+
"supported": true
116+
},
117+
"status": "success"
118+
}
119+
}
120+
```
121+
{% /tab %}
122+
123+
{% /tabs %}
124+
125+
The response follows the [standard format][], with a successful result containing **a map of amendments** as a JSON object. The keys of the object are amendment IDs. The values for each key are _amendment objects_ that describe the status of the amendment with that ID. If the request specified a `feature`, the map contains only the requested amendment object, after applying any changes from the request. Each amendment object has the following fields:
126+
127+
| `Field` | Type | Description |
128+
|:------------|:--------|:-----------------------------------------------------|
129+
| `enabled` | Boolean | Whether this amendment is currently enabled in the latest ledger. |
130+
| `name` | String | (May be omitted) The human-readable name for this amendment, if known. |
131+
| `supported` | Boolean | Whether the server knows how to apply this amendment. If this field is set to `false` (the server does not know how to apply this amendment) and `enabled` is set to `true` (this amendment is enabled in the latest ledger), this amendment may cause your server to be [amendment blocked](../../../../concepts/networks-and-servers/amendments.md#amendment-blocked-servers). |
132+
133+
{% admonition type="warning" name="Caution" %}The `name` for an amendment does not strictly indicate what that amendment does. The name is not guaranteed to be unique or consistent across servers.{% /admonition %}
134+
135+
## Possible Errors
136+
137+
- Any of the [universal error types][].
138+
- `badFeature` - The `feature` specified was invalidly formatted, or the server does not know an amendment with that name.
139+
- `noPermission` - The server does not have permission to run the specified command. For example, this can occur if the request includes admin-only fields that are not allowed, such as the `vetoed` request parameter.
140+
- `reportingUnsupported` - ([Reporting Mode][] servers only) This method is not available in Reporting Mode.
141+
142+
{% raw-partial file="/docs/_snippets/common-links.md" /%}

resources/dev-tools/components/websocket-api/data/command-list.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@
565565
"body": {
566566
"command": "version"
567567
}
568+
},
569+
{
570+
"name": "feature",
571+
"description": "Returns information about amendments this server knows about. When you connect to a cluster that includes a Clio server, the Clio method is used.",
572+
"link": "/docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature",
573+
"body": {
574+
"command": "feature",
575+
"feature": "4C97EBA926031A7CF7D7B36FDE3ED66DDA5421192D63DE53FFB46E43B9DC8373"
576+
}
568577
}
569578
]
570579
},

sidebars.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@
525525
expanded: false
526526
items:
527527
- page: docs/references/http-websocket-apis/public-api-methods/server-info-methods/fee.md
528+
- page: docs/references/http-websocket-apis/public-api-methods/server-info-methods/feature.md
528529
- page: docs/references/http-websocket-apis/public-api-methods/server-info-methods/manifest.md
529530
- page: docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_definitions.md
530531
- page: docs/references/http-websocket-apis/public-api-methods/server-info-methods/server_info.md

0 commit comments

Comments
 (0)