mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-26 15:15:49 +00:00
Add nft_info and nft_history clio model (#2310)
This commit is contained in:
@@ -90,6 +90,11 @@ import {
|
||||
NFTBuyOffersResponse,
|
||||
NFTSellOffersRequest,
|
||||
NFTSellOffersResponse,
|
||||
// clio only methods
|
||||
NFTInfoRequest,
|
||||
NFTInfoResponse,
|
||||
NFTHistoryRequest,
|
||||
NFTHistoryResponse,
|
||||
} from '../models/methods'
|
||||
import { BaseRequest, BaseResponse } from '../models/methods/baseMethod'
|
||||
import {
|
||||
@@ -316,6 +321,8 @@ class Client extends EventEmitter {
|
||||
public async request(r: ManifestRequest): Promise<ManifestResponse>
|
||||
public async request(r: NFTBuyOffersRequest): Promise<NFTBuyOffersResponse>
|
||||
public async request(r: NFTSellOffersRequest): Promise<NFTSellOffersResponse>
|
||||
public async request(r: NFTInfoRequest): Promise<NFTInfoResponse>
|
||||
public async request(r: NFTHistoryRequest): Promise<NFTHistoryResponse>
|
||||
public async request(r: NoRippleCheckRequest): Promise<NoRippleCheckResponse>
|
||||
public async request(r: PathFindRequest): Promise<PathFindResponse>
|
||||
public async request(r: PingRequest): Promise<PingResponse>
|
||||
|
||||
@@ -117,3 +117,21 @@ export interface NFTOffer {
|
||||
destination?: string
|
||||
expiration?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* One NFToken that might be returned from either an {@link NFTInfoResponse}
|
||||
*
|
||||
* @category Responses
|
||||
*/
|
||||
export interface NFToken {
|
||||
nft_id: string
|
||||
ledger_index: number
|
||||
owner: string
|
||||
is_burned: boolean
|
||||
flags: number
|
||||
transfer_fee: number
|
||||
issuer: string
|
||||
nft_taxon: number
|
||||
nft_serial: number
|
||||
uri: string
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ import { LedgerDataRequest, LedgerDataResponse } from './ledgerData'
|
||||
import { LedgerEntryRequest, LedgerEntryResponse } from './ledgerEntry'
|
||||
import { ManifestRequest, ManifestResponse } from './manifest'
|
||||
import { NFTBuyOffersRequest, NFTBuyOffersResponse } from './nftBuyOffers'
|
||||
import { NFTHistoryRequest, NFTHistoryResponse } from './nftHistory'
|
||||
import { NFTInfoRequest, NFTInfoResponse } from './nftInfo'
|
||||
import { NFTSellOffersRequest, NFTSellOffersResponse } from './nftSellOffers'
|
||||
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
|
||||
import {
|
||||
@@ -72,7 +74,6 @@ import {
|
||||
} from './transactionEntry'
|
||||
import { TxRequest, TxResponse } from './tx'
|
||||
import { UnsubscribeRequest, UnsubscribeResponse } from './unsubscribe'
|
||||
|
||||
/**
|
||||
* @category Requests
|
||||
*/
|
||||
@@ -120,6 +121,9 @@ type Request =
|
||||
// NFT methods
|
||||
| NFTBuyOffersRequest
|
||||
| NFTSellOffersRequest
|
||||
// clio only methods
|
||||
| NFTInfoRequest
|
||||
| NFTHistoryRequest
|
||||
|
||||
/**
|
||||
* @category Responses
|
||||
@@ -168,6 +172,9 @@ type Response =
|
||||
// NFT methods
|
||||
| NFTBuyOffersResponse
|
||||
| NFTSellOffersResponse
|
||||
// clio only methods
|
||||
| NFTInfoResponse
|
||||
| NFTHistoryResponse
|
||||
|
||||
export {
|
||||
Request,
|
||||
@@ -263,4 +270,9 @@ export {
|
||||
NFTBuyOffersResponse,
|
||||
NFTSellOffersRequest,
|
||||
NFTSellOffersResponse,
|
||||
// clio only methods
|
||||
NFTInfoRequest,
|
||||
NFTInfoResponse,
|
||||
NFTHistoryRequest,
|
||||
NFTHistoryResponse,
|
||||
}
|
||||
|
||||
117
packages/xrpl/src/models/methods/nftHistory.ts
Normal file
117
packages/xrpl/src/models/methods/nftHistory.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import { LedgerIndex, ResponseOnlyTxInfo } from '../common'
|
||||
import { Transaction, TransactionMetadata } from '../transactions'
|
||||
|
||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||
|
||||
/**
|
||||
* The nft_history method retrieves a list of transactions that involved the
|
||||
* specified NFToken. Expects a response in the form of a {@link
|
||||
* NFTHistoryResponse}.
|
||||
*
|
||||
* @category Requests
|
||||
*/
|
||||
export interface NFTHistoryRequest extends BaseRequest {
|
||||
command: 'nft_history'
|
||||
/**
|
||||
* The unique identifier of an NFToken.
|
||||
*/
|
||||
nft_id: string
|
||||
/**
|
||||
* Use to specify the earliest ledger to include transactions from. A value
|
||||
* of -1 instructs the server to use the earliest validated ledger version
|
||||
* available.
|
||||
*/
|
||||
ledger_index_min?: number
|
||||
/**
|
||||
* Use to specify the most recent ledger to include transactions from. A
|
||||
* value of -1 instructs the server to use the most recent validated ledger
|
||||
* version available.
|
||||
*/
|
||||
ledger_index_max?: number
|
||||
/** Use to look for transactions from a single ledger only. */
|
||||
ledger_hash?: string
|
||||
/** Use to look for transactions from a single ledger only. */
|
||||
ledger_index?: LedgerIndex
|
||||
/**
|
||||
* If true, return transactions as hex strings instead of JSON. The default is
|
||||
* false.
|
||||
*/
|
||||
binary?: boolean
|
||||
/**
|
||||
* If true, returns values indexed with the oldest ledger first. Otherwise,
|
||||
* the results are indexed with the newest ledger first.
|
||||
*/
|
||||
forward?: boolean
|
||||
/**
|
||||
* Default varies. Limit the number of transactions to retrieve. The server
|
||||
* is not required to honor this value.
|
||||
*/
|
||||
limit?: number
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
interface NFTokenTransaction {
|
||||
/** The ledger index of the ledger version that included this transaction. */
|
||||
ledger_index: number
|
||||
/**
|
||||
* If binary is True, then this is a hex string of the transaction metadata.
|
||||
* Otherwise, the transaction metadata is included in JSON format.
|
||||
*/
|
||||
meta: string | TransactionMetadata
|
||||
/** JSON object defining the transaction. */
|
||||
tx?: Transaction & ResponseOnlyTxInfo
|
||||
/** Unique hashed String representing the transaction. */
|
||||
tx_blob?: string
|
||||
/**
|
||||
* Whether or not the transaction is included in a validated ledger. Any
|
||||
* transaction not yet in a validated ledger is subject to change.
|
||||
*/
|
||||
validated: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected response from an {@link NFTHistoryRequest}.
|
||||
*
|
||||
* @category Responses
|
||||
*/
|
||||
export interface NFTHistoryResponse extends BaseResponse {
|
||||
result: {
|
||||
/**
|
||||
* The unique identifier of an NFToken.
|
||||
*/
|
||||
nft_id: string
|
||||
/**
|
||||
* The ledger index of the earliest ledger actually searched for
|
||||
* transactions.
|
||||
*/
|
||||
ledger_index_min: number
|
||||
/**
|
||||
* The ledger index of the most recent ledger actually searched for
|
||||
* transactions.
|
||||
*/
|
||||
ledger_index_max: number
|
||||
/** The limit value used in the request. */
|
||||
limit?: number
|
||||
/**
|
||||
* Server-defined value indicating the response is paginated. Pass this
|
||||
* to the next call to resume where this call left off.
|
||||
*/
|
||||
marker?: unknown
|
||||
/**
|
||||
* Array of transactions matching the request's criteria, as explained
|
||||
* below.
|
||||
*/
|
||||
transactions: NFTokenTransaction[]
|
||||
/**
|
||||
* If included and set to true, the information in this response comes from
|
||||
* a validated ledger version. Otherwise, the information is subject to
|
||||
* change.
|
||||
*/
|
||||
validated?: boolean
|
||||
}
|
||||
}
|
||||
33
packages/xrpl/src/models/methods/nftInfo.ts
Normal file
33
packages/xrpl/src/models/methods/nftInfo.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { LedgerIndex, NFToken } from '../common'
|
||||
|
||||
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||
|
||||
/**
|
||||
* The `nft_info` method retrieves information about NFToken
|
||||
* NFToken.
|
||||
*
|
||||
* @category Requests
|
||||
*/
|
||||
export interface NFTInfoRequest extends BaseRequest {
|
||||
command: 'nft_info'
|
||||
/**
|
||||
* The unique identifier of an NFToken.
|
||||
*/
|
||||
nft_id: string
|
||||
/** A 20-byte hex string for the ledger version to use. */
|
||||
ledger_hash?: string
|
||||
/**
|
||||
* The ledger index of the ledger to use, or a shortcut string to choose a
|
||||
* ledger automatically.
|
||||
*/
|
||||
ledger_index?: LedgerIndex
|
||||
}
|
||||
|
||||
/**
|
||||
* Response expected from an {@link NFTInfoResponse}.
|
||||
*
|
||||
* @category Responses
|
||||
*/
|
||||
export interface NFTInfoResponse extends BaseResponse {
|
||||
result: NFToken
|
||||
}
|
||||
Reference in New Issue
Block a user