Skip to content

Commit 39d8277

Browse files
authored
account_lines request schema (#6)
1 parent 8bc5f3d commit 39d8277

File tree

8 files changed

+310
-1
lines changed

8 files changed

+310
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
components:
2+
schemas:
3+
AccountLinesRequest:
4+
$id: AccountLinesRequest
5+
type: object
6+
description: >
7+
The account_lines command retrieves information about an account's trust lines, including balances in all non-XRP currencies and assets.
8+
All information retrieved is relative to a particular version of the ledger.
9+
allOf:
10+
- $ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesRequest'
11+
- type: object
12+
properties:
13+
command:
14+
$ref: '../../shared/base.yaml#/components/schemas/CommandTypes'
15+
id:
16+
# Not specifying a type is how we express "any" value is acceptable
17+
description: 'A unique identifier for the request.'
18+
required:
19+
- command
20+
- id
21+
example:
22+
id: 2
23+
command: account_lines
24+
account: rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn
25+
ledger_index: validated
26+
27+
AccountLinesResponse:
28+
$id: AccountLinesResponse
29+
type: object
30+
oneOf:
31+
- $ref: '#/components/schemas/AccountLinesSuccessResponse'
32+
- $ref: '#/components/schemas/AccountLinesErrorResponse'
33+
properties:
34+
id:
35+
# Not specifying a type is how we express "any" value is acceptable
36+
description: 'A unique identifier for the request.'
37+
type:
38+
type: string
39+
description: The value response indicates a direct response to an API request. Asynchronous notifications use a different value such as `ledgerClosed` or `transaction`.
40+
enum:
41+
- response
42+
required:
43+
- id
44+
- type
45+
example:
46+
id: 2
47+
type: response
48+
result:
49+
account: rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn
50+
ledger_hash: 16566FE44F0222B4373BBA5CD8B62AA0200D1D42031A946D15F96DE5479A1564
51+
ledger_index: 90395101
52+
validated: true
53+
limit: 200
54+
lines:
55+
- account: rJF9txJpy3RG7XkXsiL72us5X5txbQDFgA
56+
balance: '0'
57+
currency: VGB
58+
limit: '0'
59+
limit_peer: '100000000'
60+
quality_in: 0
61+
quality_out: 0
62+
no_ripple: false
63+
no_ripple_peer: true
64+
- account: rJXhkzNcijhgwkPHUT966Mhr22b4CwPkjS
65+
balance: '0'
66+
currency: USD
67+
limit: '0'
68+
limit_peer: '14.0301'
69+
quality_in: 0
70+
quality_out: 0
71+
no_ripple: false
72+
no_ripple_peer: true
73+
status: success
74+
type: response
75+
warnings:
76+
- id: 2001
77+
message:
78+
This is a clio server. clio only serves validated data. If you want to
79+
talk to rippled, include 'ledger_index':'current' in your request
80+
81+
AccountLinesSuccessResponse:
82+
$id: AccountLinesSuccessResponse
83+
allOf:
84+
- $ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesSuccessResponse'
85+
- type: object
86+
properties:
87+
status:
88+
type: string
89+
enum:
90+
- success
91+
required:
92+
- status
93+
94+
AccountLinesErrorResponse:
95+
$id: AccountLinesErrorResponse
96+
allOf:
97+
- $ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesErrorResponse'
98+
- type: object
99+
properties:
100+
status:
101+
type: string
102+
enum:
103+
- error
104+
required:
105+
- status

async_api/websocket_api.yaml

+18-1
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ channels:
5353
# Reusable message references
5454
- $ref: '#/components/messages/AccountChannelsRequest'
5555
- $ref: '#/components/messages/AccountInfoRequest'
56+
- $ref: '#/components/messages/AccountLinesRequest'
5657
# ... (Add references for additional requests)
5758
publish:
5859
operationId: publishToRoot
5960
message:
6061
oneOf:
6162
- $ref: '#/components/messages/AccountChannelsResponse'
6263
- $ref: '#/components/messages/AccountInfoResponseV1'
64+
- $ref: '#/components/messages/AccountLinesResponse'
6365
# ... (Add references for additional responses)
6466

6567
# Moved message definitions to a separate components section
@@ -81,6 +83,14 @@ components:
8183
payload:
8284
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoRequest'
8385

86+
# Account lines request message
87+
AccountLinesRequest:
88+
name: AccountLinesRequest
89+
messageId: AccountLinesRequest
90+
contentType: application/json
91+
payload:
92+
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesRequest'
93+
8494
# ... (Add definitions for additional message types)
8595

8696
# Account channels response message
@@ -94,9 +104,16 @@ components:
94104
# Account info response message (version 1)
95105
AccountInfoResponseV1:
96106
name: AccountInfoResponse
97-
messageId: AccountInfoResponseV1 # Consider using a version suffix
107+
messageId: AccountInfoResponseV1 # Consider using a version suffix
98108
contentType: application/json
99109
payload:
100110
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoResponseV1'
101111

112+
# Account lines response message
113+
AccountLinesResponse:
114+
name: AccountLinesResponse
115+
messageId: AccountLinesResponse
116+
contentType: application/json
117+
payload:
118+
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesResponse'
102119
# ... (Add definitions for additional response types)

async_api/websocket_api_v2.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ channels:
5858
contentType: application/json
5959
payload:
6060
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoRequest'
61+
- name: AccountLinesRequest
62+
messageId: AccountLinesRequest
63+
contentType: application/json
64+
payload:
65+
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesRequest'
6166
# TODO: Add additional request types for individual requests here
6267
publish:
6368
operationId: publishToRoot
@@ -73,4 +78,9 @@ channels:
7378
contentType: application/json
7479
payload:
7580
$ref: './requests/account_info_async_api.yaml#/components/schemas/AccountInfoResponseV2'
81+
- name: AccountLinesResponse
82+
messageId: AccountLinesResponse
83+
contentType: application/json
84+
payload:
85+
$ref: './requests/account_lines_async_api.yaml#/components/schemas/AccountLinesResponse'
7686
# TODO: Add additional response types for individual requests here

open_api/json_api.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ paths:
3333
mapping:
3434
account_channels: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest' # TODO: Verify this is the correct syntax
3535
account_info: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
36+
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
3637
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
3738
# TODO: Add the rest of the JSON RPC requests here
3839
oneOf:
3940
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
4041
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
42+
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
4143
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
4244
# TODO: Add the rest of the JSON RPC requests here
4345
required: true
@@ -58,6 +60,7 @@ paths:
5860
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsResponse'
5961
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoResponseV1'
6062
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitResponseV1'
63+
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesResponse'
6164
# TODO: Add the rest of the JSON RPC responses here
6265

6366
# TODO: We want to be much more explicit with http error codes for a full implementation of this spec.

open_api/json_api_v2.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ paths:
3232
account_channels: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest' # TODO: Verify this is the correct syntax
3333
account_info: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
3434
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
35+
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
3536
# TODO: Add the rest of the JSON RPC requests here
3637
oneOf:
3738
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
3839
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoRequest'
3940
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV2'
41+
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
4042
# TODO: Add the rest of the JSON RPC requests here
4143
required: true
4244
operationId: 'POST'
@@ -50,6 +52,7 @@ paths:
5052
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsResponse'
5153
- $ref: 'requests/account_info_open_api.yaml#/components/schemas/AccountInfoResponseV2'
5254
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitResponseV2'
55+
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesResponse'
5356
# TODO: Add the rest of the JSON RPC responses here
5457

5558
# TODO: We want to be much more explicit with http error codes for a full implementation of this spec.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
components:
2+
schemas:
3+
AccountLinesRequest:
4+
type: object
5+
description: >
6+
The account_lines command retrieves information about an account's trust lines, including balances in all non-XRP currencies and assets.
7+
All information retrieved is relative to a particular version of the ledger.
8+
Returns an AccountLinesResponse
9+
properties:
10+
method:
11+
type: string
12+
enum:
13+
- account_lines
14+
params:
15+
type: array
16+
items:
17+
$ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesRequest'
18+
required:
19+
- method
20+
example:
21+
method: 'account_lines'
22+
params:
23+
- account: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn'
24+
ledger_index: 'current'
25+
peer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B'
26+
limit: 200
27+
28+
AccountLinesResponse:
29+
type: object
30+
properties:
31+
result:
32+
type: object
33+
discriminator:
34+
propertyName: status
35+
mapping:
36+
success: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesSuccessResponse'
37+
error: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesErrorResponse'
38+
oneOf:
39+
- $ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesSuccessResponse'
40+
- $ref: '../../shared/requests/account_lines.yaml#/components/schemas/AccountLinesErrorResponse'
41+
required:
42+
- result
43+
example:
44+
result:
45+
account: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn'
46+
lines:
47+
- account: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B'
48+
balance: '0'
49+
currency: 'USD'
50+
limit: '1000000000'
51+
limit_peer: '0'
52+
quality_in: 0
53+
quality_out: 0
54+
ledger_current_index: 14380380
55+
validated: false
56+
status: 'success'

shared/base.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ components:
77
- account_channels
88
- account_info
99
- submit
10+
- account_lines
1011

1112
ResponseWarning:
1213
$id: ResponseWarning

0 commit comments

Comments
 (0)