Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nfts_by_issuer data type #2694

Merged
merged 9 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/xrpl/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xrpl-announce) for release announcements. We recommend that xrpl.js (ripple-lib) users stay up-to-date with the latest stable release.

## Unreleased

### Added
* Add `nfts_by_issuer` clio-only API definition

shawnxie999 marked this conversation as resolved.
Show resolved Hide resolved
### BREAKING CHANGES
* Small fix in the API to use a new flag name `tfNoDirectRipple` instead of the existing flag name `tfNoRippleDirect`

Expand Down
7 changes: 7 additions & 0 deletions packages/xrpl/src/models/methods/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import {
NFTHistoryTransaction,
} from './nftHistory'
import { NFTInfoRequest, NFTInfoResponse } from './nftInfo'
import { NFTsByIssuerRequest, NFTsByIssuerResponse } from './nftsByIssuer'
import { NFTSellOffersRequest, NFTSellOffersResponse } from './nftSellOffers'
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
import {
Expand Down Expand Up @@ -212,6 +213,7 @@ type Request =
// clio only methods
| NFTInfoRequest
| NFTHistoryRequest
| NFTsByIssuerRequest
// AMM methods
| AMMInfoRequest
// Price Oracle methods
Expand Down Expand Up @@ -268,6 +270,7 @@ type Response =
// clio only methods
| NFTInfoResponse
| NFTHistoryResponse
| NFTsByIssuerResponse
// AMM methods
| AMMInfoResponse
// Price Oracle methods
Expand Down Expand Up @@ -413,6 +416,8 @@ export type RequestResponseMap<T> = T extends AccountChannelsRequest
? NFTSellOffersResponse
: T extends NFTInfoRequest
? NFTInfoResponse
: T extends NFTsByIssuerRequest
? NFTsByIssuerResponse
: T extends NFTHistoryRequest
? NFTHistoryResponse
: Response
Expand Down Expand Up @@ -582,6 +587,8 @@ export {
NFTHistoryRequest,
NFTHistoryResponse,
NFTHistoryTransaction,
NFTsByIssuerRequest,
NFTsByIssuerResponse,
// AMM methods
AMMInfoRequest,
AMMInfoResponse,
Expand Down
68 changes: 68 additions & 0 deletions packages/xrpl/src/models/methods/nftsByIssuer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { NFToken } from '../common'

import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'

/**
* The nfts_by_issuer method returns a list of NFTokens issued by the account.
* The order of the NFTs is not associated with the date the NFTs were minted.
* Expects a response in the form of a {@link
* NFTsByIssuerResponse}.
*
* @category Requests
*/
export interface NFTsByIssuerRequest
Copy link
Collaborator

@pdp2121 pdp2121 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface should be imported into the index file of methods, then client to be available for public use and matched with the response. You could follow the same steps of other methods (i.e AccountChannels)

extends BaseRequest,
LookupByLedgerRequest {
command: 'nfts_by_issuer'
/**
* A unique identifier for the account, most commonly the account's address
*/
issuer: string
/**
* Value from a previous paginated response. Resume retrieving data where
* that response left off. This value is stable even if there is a change in
* the server's range of available ledgers.
*/
marker?: unknown
/**
* Filter NFTs issued by this issuer that have this taxon.
*/
nft_taxon?: number
/**
* Default varies. Limit the number of transactions to retrieve. The server
* is not required to honor this value.
*/
limit?: number
}

/**
* Expected response from an {@link NFTsByIssuerRequest}.
*
* @category Responses
*/
export interface NFTsByIssuerResponse extends BaseResponse {
pdp2121 marked this conversation as resolved.
Show resolved Hide resolved
result: {
/**
* The unique identifier for the account, most commonly the account's address
*/
issuer: string
/**
* A list of NFTs issued by the account.
* The order of the NFTs is not associated with the date the NFTs were minted.
*/
nfts: NFToken[]
/**
* Server-defined value indicating the response is paginated. Pass this
* to the next call to resume where this call left off.
*/
marker?: unknown
/**
* The limit value used in the request.
*/
limit?: number
/**
* Use to filter NFTs issued by this issuer that have this taxon.
*/
nft_taxon?: number
}
}