Skip to content

Commit

Permalink
add account_nfts
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 committed Jan 21, 2025
1 parent 1cc20ca commit bc3b725
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 2 deletions.
71 changes: 71 additions & 0 deletions async_api/requests/account_nfts_async_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
components:
schemas:
AccountNftsRequest:
type: object
allOf:
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsRequest
properties:
command:
type: string
enum:
- account_nfts
id:
description: A unique identifier for the request.
required:
- command
- id
example:
command: account_nfts
account: rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx
ledger_index: validated
AccountNftsResponse:
type: object
properties:
result:
type: object
discriminator:
propertyName: status
mapping:
success: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsSuccessResponse
error: '#/components/schemas/AccountNftsErrorResponse'
oneOf:
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsSuccessResponse
- $ref: '#/components/schemas/AccountNftsErrorResponse'
id:
description: A unique identifier for the request.
type:
type: string
description:
The value response indicates a direct response to an API request.
Asynchronous notifications use a different value such as
`ledgerClosed` or `transaction`.
enum:
- response
required:
- id
- type
example:
result:
account: rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx
account_nfts:
- Flags: 1
Issuer: rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm
NFTokenID: 00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004
NFTokenTaxon: 0
URI: 697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469
nft_serial: 4
- Flags: 1
Issuer: rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm
NFTokenID: 00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE087727D1EA000000005
NFTokenTaxon: 0
URI: 697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469
nft_serial: 5
ledger_hash: 7971093E67341E325251268A5B7CD665EF450B126F67DF8384D964DF834961E8
ledger_index: 2380540
validated: true
status: success
type: response
AccountNftsErrorResponse:
oneOf:
- $ref: ../../shared/base.yaml#/components/schemas/WebsocketErrorFields
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsErrorResponse
22 changes: 21 additions & 1 deletion async_api/websocket_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ channels:
- $ref: '#/components/messages/AccountInfoRequest'
- $ref: '#/components/messages/AccountLinesRequest'
- $ref: '#/components/messages/LedgerEntryRequest'
- $ref: '#/components/messages/AccountCurrenciesRequest'
- $ref: '#/components/messages/AccountNftsRequest'
# ... (Add references for additional requests)
publish:
operationId: publishToRoot
Expand All @@ -64,6 +66,8 @@ channels:
- $ref: '#/components/messages/AccountInfoResponseV1'
- $ref: '#/components/messages/AccountLinesResponse'
- $ref: '#/components/messages/LedgerEntryResponse'
- $ref: '#/components/messages/AccountCurrenciesResponse'
- $ref: '#/components/messages/AccountNftsResponse'
# ... (Add references for additional responses)

# Moved message definitions to a separate components section
Expand Down Expand Up @@ -101,14 +105,22 @@ components:
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryRequest'

# Account channels request message
# Account currencies request message
AccountCurrenciesRequest:
name: AccountCurrenciesRequest
messageId: AccountCurrenciesRequest
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesRequest'

# Account nfts request message
AccountNftsRequest:
name: AccountNftsRequest
messageId: AccountNftsRequest
contentType: application/json
payload:
$ref: './requests/account_nfts_async_api.yaml#/components/schemas/AccountNftsRequest'

# ... (Add definitions for additional message types)

# Account channels response message
Expand Down Expand Up @@ -151,4 +163,12 @@ components:
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesResponse'

# Account nfts response message
AccountNftsResponse:
name: AccountNftsResponse
messageId: AccountNftsResponse
contentType: application/json
payload:
$ref: './requests/account_nfts_async_api.yaml#/components/schemas/AccountNftsResponse'

# ... (Add definitions for additional response types)
22 changes: 21 additions & 1 deletion async_api/websocket_api_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ channels:
- $ref: '#/components/messages/AccountInfoRequest'
- $ref: '#/components/messages/AccountLinesRequest'
- $ref: '#/components/messages/LedgerEntryRequest'
- $ref: '#/components/messages/AccountCurrenciesRequest'
- $ref: '#/components/messages/AccountNftsRequest'
# ... (Add references for additional requests)
publish:
operationId: publishToRoot
Expand All @@ -63,6 +65,8 @@ channels:
- $ref: '#/components/messages/AccountInfoResponseV2'
- $ref: '#/components/messages/AccountLinesResponse'
- $ref: '#/components/messages/LedgerEntryResponse'
- $ref: '#/components/messages/AccountCurrenciesResponse'
- $ref: '#/components/messages/AccountNftsResponse'
# ... (Add references for additional responses)

# Moved message definitions to a separate components section
Expand Down Expand Up @@ -100,14 +104,22 @@ components:
payload:
$ref: './requests/ledger_entry_async_api.yaml#/components/schemas/LedgerEntryRequest'

# Account channels request message
# Account currencies request message
AccountCurrenciesRequest:
name: AccountCurrenciesRequest
messageId: AccountCurrenciesRequest
contentType: application/json
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesRequest'

# Account nfts request message
AccountNftsRequest:
name: AccountNftsRequest
messageId: AccountNftsRequest
contentType: application/json
payload:
$ref: './requests/account_nfts_async_api.yaml#/components/schemas/AccountNftsRequest'

# ... (Add definitions for additional message types)

# Account channels response message
Expand Down Expand Up @@ -150,4 +162,12 @@ components:
payload:
$ref: './requests/account_currencies_async_api.yaml#/components/schemas/AccountCurrenciesResponse'

# Account nfts response message
AccountNftsResponse:
name: AccountNftsResponse
messageId: AccountNftsResponse
contentType: application/json
payload:
$ref: './requests/account_nfts_async_api.yaml#/components/schemas/AccountNftsResponse'

# ... (Add definitions for additional response types)
2 changes: 2 additions & 0 deletions open_api/json_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ paths:
submit: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
ledger_entry: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
account_currencies: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
account_nfts: 'requests/account_nfts_open_api.yaml#/components/schemas/AccountNftsRequest'
# TODO: Add the rest of the JSON RPC requests here
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
Expand All @@ -45,6 +46,7 @@ paths:
- $ref: 'requests/submit_open_api.yaml#/components/schemas/SubmitRequestV1'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
- $ref: 'requests/account_nfts_open_api.yaml#/components/schemas/AccountNftsRequest'
# TODO: Add the rest of the JSON RPC requests here
required: true
operationId: 'POST'
Expand Down
2 changes: 2 additions & 0 deletions open_api/json_api_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ paths:
account_lines: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
ledger_entry: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
account_currencies: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
account_nfts: 'requests/account_nfts_open_api.yaml#/components/schemas/AccountNftsRequest'
# TODO: Add the rest of the JSON RPC requests here
oneOf:
- $ref: 'requests/account_channels_open_api.yaml#/components/schemas/AccountChannelsRequest'
Expand All @@ -43,6 +44,7 @@ paths:
- $ref: 'requests/account_lines_open_api.yaml#/components/schemas/AccountLinesRequest'
- $ref: 'requests/ledger_entry_open_api.yaml#/components/schemas/LedgerEntryRequest'
- $ref: 'requests/account_currencies_open_api.yaml#/components/schemas/AccountCurrenciesRequest'
- $ref: 'requests/account_nfts_open_api.yaml#/components/schemas/AccountNftsRequest'
# TODO: Add the rest of the JSON RPC requests here
required: true
operationId: 'POST'
Expand Down
61 changes: 61 additions & 0 deletions open_api/requests/account_nfts_open_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
components:
schemas:
AccountNftsRequest:
type: object
description: ''
properties:
method:
type: string
enum:
- account_nfts
params:
type: array
items:
$ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsRequest
required:
- method
example:
method: account_nfts
params:
- account: rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx
ledger_index: validated
AccountNftsResponse:
type: object
properties:
result:
type: object
discriminator:
propertyName: status
mapping:
success: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsSuccessResponse
error: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsErrorResponse
oneOf:
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsSuccessResponse
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsErrorResponse
required:
- result
example:
result:
account: rsuHaTvJh1bDmDoxX9QcKP7HEBSBt4XsHx
account_nfts:
- Flags: 1
Issuer: rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm
NFTokenID: 00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE0875B974D9F00000004
NFTokenTaxon: 0
URI: 697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469
nft_serial: 4
- Flags: 1
Issuer: rGJUF4PvVkMNxG6Bg6AKg3avhrtQyAffcm
NFTokenID: 00010000A7CAD27B688D14BA1A9FA5366554D6ADCF9CE087727D1EA000000005
NFTokenTaxon: 0
URI: 697066733A2F2F62616679626569676479727A74357366703775646D37687537367568377932366E6634646675796C71616266336F636C67747179353566627A6469
nft_serial: 5
ledger_hash: 46497E9FF17A993324F1A0A693DC068B467184023C7FD162812265EAAFEB97CB
ledger_index: 2380559
status: success
validated: true
AccountNftsSuccessResponse:
type: object
allOf:
- $ref: ../../shared/base.yaml#/components/schemas/BaseSuccessResponse
- $ref: ../../shared/requests/account_nfts.yaml#/components/schemas/AccountNftsSuccessResponse
2 changes: 2 additions & 0 deletions shared/requests/account_currencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ components:
account:
type: string
description: 'Look up currencies this account can send or receive. Updated in: rippled 1.11.0'
required:
- account

AccountCurrenciesSuccessResponse:
type: object
Expand Down
96 changes: 96 additions & 0 deletions shared/requests/account_nfts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
components:
schemas:
AccountNftsRequest:
description: 'The account_nfts method returns a list of NFToken objects for the specified account.'
type: object
allOf:
- $ref: '../base.yaml#/components/schemas/BaseRequest'
- $ref: '../base.yaml#/components/schemas/LookupByLedgerRequest'
properties:
account:
type: string
description: The unique identifier of an account, typically the account's Address. The request returns a list of NFTs owned by this account.
limit:
type: integer
description: (Optional) Limit the number of token pages to retrieve. Each page can contain up to 32 NFTs. The limit value cannot be lower than 20 or more than 400. Positive values outside this range are replaced with the closest valid option. The default is 100.
marker:
type: string
description: (Optional) Value from a previous paginated response. Resume retrieving data where that response left off.
required:
- account
AccountNftsSuccessResponse:
type: object
allOf:
- $ref: '../base.yaml#/components/schemas/BaseSuccessResponse'
properties:
account:
type: string
description: The account that owns the list of NFTs.
account_nfts:
type: array
items:
$ref: '#/components/schemas/NFToken'
description: A list of NFTs owned by the account, formatted as NFT Objects.
ledger_hash:
type: string
description: (May be omitted) The identifying hash of the ledger that was used to generate this response.
ledger_index:
type: integer
description: (May be omitted) The ledger index of the ledger that was used to generate this response.
ledger_current_index:
type: integer
description: (May be omitted) The ledger index of the current in-progress ledger version, which was used to generate this response.
validated:
type: boolean
description: If included and set to true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
marker:
type: string
description: (May be omitted) Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no additional pages after this one.
NFToken:
type: object
properties:
Flags:
type: integer
description: A bit-map of boolean flags enabled for this NFToken. See NFToken Flags for possible values.
Issuer:
type: string
description: The account that issued this NFToken.
NFTokenID:
type: string
description: The unique identifier of this NFToken, in hexadecimal.
NFTokenTaxon:
type: integer
description: The unscrambled version of this token's taxon. Several tokens with the same taxon might represent instances of a limited series.
URI:
type: string
description: The URI data associated with this NFToken, in hexadecimal.
nft_serial:
type: integer
description: The token sequence number of this NFToken, which is unique for its issuer.

AccountNftsErrorResponse:
description: ''
type: object
properties:
error:
type: string
oneOf:
- $ref: '../base.yaml#/components/schemas/UniversalErrorResponseCodes'
- enum:
- invalidParams
- actNotFound
- lgrNotFound
description: >
* `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
* `actNotFound` - The address specified in the `account` field of the request does not correspond to an account in the ledger.
* `lgrNotFound` - The ledger specified by the `ledger_hash` or `ledger_index` does not exist, or it does exist but the server does not have it.
status:
type: string
enum:
- error
request:
$ref: '#/components/schemas/AccountCurrenciesRequest'
required:
- status
- error
- request

0 comments on commit bc3b725

Please sign in to comment.