mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 21:15:47 +00:00
add requests and responses
This commit is contained in:
68
src/models/methods/accountNFTs.ts
Normal file
68
src/models/methods/accountNFTs.ts
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `account_nfts` method retrieves all of the NFTs currently owned by the
|
||||||
|
* specified account.
|
||||||
|
*
|
||||||
|
* @category Requests
|
||||||
|
*/
|
||||||
|
export interface AccountNFTsRequest extends BaseRequest {
|
||||||
|
command: 'account_nfts'
|
||||||
|
/**
|
||||||
|
* The unique identifier of an account, typically the account's address. The
|
||||||
|
* request returns NFTs owned by this account.
|
||||||
|
*/
|
||||||
|
account: string
|
||||||
|
/**
|
||||||
|
* Limit the number of NFTokens to retrieve.
|
||||||
|
*/
|
||||||
|
limit?: number
|
||||||
|
/**
|
||||||
|
* Value from a previous paginated response. Resume retrieving data where
|
||||||
|
* that response left off.
|
||||||
|
*/
|
||||||
|
marker?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One NFToken that might be returned from an {@link AccountNFTsRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
interface AccountNFToken {
|
||||||
|
// TODO Need to check all this
|
||||||
|
Flags: number
|
||||||
|
Issuer: string
|
||||||
|
TokenID: string
|
||||||
|
TokenTaxons: number
|
||||||
|
nft_serial: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response expected from an {@link AccountNFTsRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
export interface AccountNFTsResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
/**
|
||||||
|
* A list of NFTs owned by the specified account.
|
||||||
|
*/
|
||||||
|
account_nfts: AccountNFToken[]
|
||||||
|
/**
|
||||||
|
* The ledger index of the current open ledger, which was used when
|
||||||
|
* retrieving this information.
|
||||||
|
*/
|
||||||
|
ledger_current_index: number
|
||||||
|
/** If true, this data comes from a validated ledger. */
|
||||||
|
validated: boolean
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
marker?: unknown
|
||||||
|
/** The limit that was used to fulfill this request. */
|
||||||
|
limit?: number
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from './accountCurrencies'
|
} from './accountCurrencies'
|
||||||
import { AccountInfoRequest, AccountInfoResponse } from './accountInfo'
|
import { AccountInfoRequest, AccountInfoResponse } from './accountInfo'
|
||||||
import { AccountLinesRequest, AccountLinesResponse } from './accountLines'
|
import { AccountLinesRequest, AccountLinesResponse } from './accountLines'
|
||||||
|
import { AccountNFTsRequest, AccountNFTsResponse } from './accountNFTs'
|
||||||
import { AccountObjectsRequest, AccountObjectsResponse } from './accountObjects'
|
import { AccountObjectsRequest, AccountObjectsResponse } from './accountObjects'
|
||||||
import { AccountOffersRequest, AccountOffersResponse } from './accountOffers'
|
import { AccountOffersRequest, AccountOffersResponse } from './accountOffers'
|
||||||
import { AccountTxRequest, AccountTxResponse } from './accountTx'
|
import { AccountTxRequest, AccountTxResponse } from './accountTx'
|
||||||
@@ -29,6 +30,8 @@ import { LedgerCurrentRequest, LedgerCurrentResponse } from './ledgerCurrent'
|
|||||||
import { LedgerDataRequest, LedgerDataResponse } from './ledgerData'
|
import { LedgerDataRequest, LedgerDataResponse } from './ledgerData'
|
||||||
import { LedgerEntryRequest, LedgerEntryResponse } from './ledgerEntry'
|
import { LedgerEntryRequest, LedgerEntryResponse } from './ledgerEntry'
|
||||||
import { ManifestRequest, ManifestResponse } from './manifest'
|
import { ManifestRequest, ManifestResponse } from './manifest'
|
||||||
|
import { NFTBuyOffersRequest, NFTBuyOffersResponse } from './nftBuyOffers'
|
||||||
|
import { NFTSellOffersRequest, NFTSellOffersResponse } from './nftSellOffers'
|
||||||
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
|
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
|
||||||
import { PathFindRequest, PathFindResponse } from './pathFind'
|
import { PathFindRequest, PathFindResponse } from './pathFind'
|
||||||
import { PingRequest, PingResponse } from './ping'
|
import { PingRequest, PingResponse } from './ping'
|
||||||
@@ -64,10 +67,12 @@ import { UnsubscribeRequest, UnsubscribeResponse } from './unsubscribe'
|
|||||||
* @category Requests
|
* @category Requests
|
||||||
*/
|
*/
|
||||||
type Request =
|
type Request =
|
||||||
|
// account methods
|
||||||
| AccountChannelsRequest
|
| AccountChannelsRequest
|
||||||
| AccountCurrenciesRequest
|
| AccountCurrenciesRequest
|
||||||
| AccountInfoRequest
|
| AccountInfoRequest
|
||||||
| AccountLinesRequest
|
| AccountLinesRequest
|
||||||
|
| AccountNFTsRequest
|
||||||
| AccountObjectsRequest
|
| AccountObjectsRequest
|
||||||
| AccountOffersRequest
|
| AccountOffersRequest
|
||||||
| AccountTxRequest
|
| AccountTxRequest
|
||||||
@@ -102,15 +107,20 @@ type Request =
|
|||||||
// utility methods
|
// utility methods
|
||||||
| PingRequest
|
| PingRequest
|
||||||
| RandomRequest
|
| RandomRequest
|
||||||
|
// NFT methods
|
||||||
|
| NFTBuyOffersRequest
|
||||||
|
| NFTSellOffersRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Responses
|
* @category Responses
|
||||||
*/
|
*/
|
||||||
type Response =
|
type Response =
|
||||||
|
// account methods
|
||||||
| AccountChannelsResponse
|
| AccountChannelsResponse
|
||||||
| AccountCurrenciesResponse
|
| AccountCurrenciesResponse
|
||||||
| AccountInfoResponse
|
| AccountInfoResponse
|
||||||
| AccountLinesResponse
|
| AccountLinesResponse
|
||||||
|
| AccountNFTsResponse
|
||||||
| AccountObjectsResponse
|
| AccountObjectsResponse
|
||||||
| AccountOffersResponse
|
| AccountOffersResponse
|
||||||
| AccountTxResponse
|
| AccountTxResponse
|
||||||
@@ -145,6 +155,9 @@ type Response =
|
|||||||
// utility methods
|
// utility methods
|
||||||
| PingResponse
|
| PingResponse
|
||||||
| RandomResponse
|
| RandomResponse
|
||||||
|
// NFT methods
|
||||||
|
| NFTBuyOffersResponse
|
||||||
|
| NFTSellOffersResponse
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Request,
|
Request,
|
||||||
@@ -158,6 +171,8 @@ export {
|
|||||||
AccountInfoResponse,
|
AccountInfoResponse,
|
||||||
AccountLinesRequest,
|
AccountLinesRequest,
|
||||||
AccountLinesResponse,
|
AccountLinesResponse,
|
||||||
|
AccountNFTsRequest,
|
||||||
|
AccountNFTsResponse,
|
||||||
AccountObjectsRequest,
|
AccountObjectsRequest,
|
||||||
AccountObjectsResponse,
|
AccountObjectsResponse,
|
||||||
AccountOffersRequest,
|
AccountOffersRequest,
|
||||||
@@ -228,4 +243,9 @@ export {
|
|||||||
RandomRequest,
|
RandomRequest,
|
||||||
RandomResponse,
|
RandomResponse,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
|
// NFT methods
|
||||||
|
NFTBuyOffersRequest,
|
||||||
|
NFTBuyOffersResponse,
|
||||||
|
NFTSellOffersRequest,
|
||||||
|
NFTSellOffersResponse,
|
||||||
}
|
}
|
||||||
|
|||||||
50
src/models/methods/nftBuyOffers.ts
Normal file
50
src/models/methods/nftBuyOffers.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { Amount } from '../common'
|
||||||
|
|
||||||
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `nft_buy_offers` method retrieves all of buy offers for the specified
|
||||||
|
* NFToken.
|
||||||
|
*
|
||||||
|
* @category Requests
|
||||||
|
*/
|
||||||
|
export interface NFTBuyOffersRequest extends BaseRequest {
|
||||||
|
command: 'nft_buy_offers'
|
||||||
|
/**
|
||||||
|
* The unique identifier of an NFToken. The request returns buy offers for this NFToken.
|
||||||
|
*/
|
||||||
|
tokenid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One buy offer that might be returned from an {@link NFTBuyOffersRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
interface NFTBuyOffer {
|
||||||
|
// TODO Need to check all this
|
||||||
|
amount: Amount
|
||||||
|
destination: string
|
||||||
|
expiration: number
|
||||||
|
flags: number
|
||||||
|
index: string
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response expected from an {@link NFTBuyOffersRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
export interface NFTBuyOffersResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
/**
|
||||||
|
* A list of buy offers for the specified NFToken.
|
||||||
|
*/
|
||||||
|
offers: NFTBuyOffer[]
|
||||||
|
/**
|
||||||
|
* The token ID of the NFToken to which these offers pertain.
|
||||||
|
*/
|
||||||
|
tokenid: string
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/models/methods/nftSellOffers.ts
Normal file
50
src/models/methods/nftSellOffers.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { Amount } from '../common'
|
||||||
|
|
||||||
|
import { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `nft_sell_offers` method retrieves all of sell offers for the specified
|
||||||
|
* NFToken.
|
||||||
|
*
|
||||||
|
* @category Requests
|
||||||
|
*/
|
||||||
|
export interface NFTSellOffersRequest extends BaseRequest {
|
||||||
|
command: 'nft_sell_offers'
|
||||||
|
/**
|
||||||
|
* The unique identifier of an NFToken. The request returns sell offers for this NFToken.
|
||||||
|
*/
|
||||||
|
tokenid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One sell offer that might be returned from an {@link NFTSellOffersRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
interface NFTSellOffer {
|
||||||
|
// TODO Need to check all this
|
||||||
|
amount: Amount
|
||||||
|
destination: string
|
||||||
|
expiration: number
|
||||||
|
flags: number
|
||||||
|
index: string
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response expected from an {@link NFTSellOffersRequest}.
|
||||||
|
*
|
||||||
|
* @category Responses
|
||||||
|
*/
|
||||||
|
export interface NFTSellOffersResponse extends BaseResponse {
|
||||||
|
result: {
|
||||||
|
/**
|
||||||
|
* A list of sell offers for the specified NFToken.
|
||||||
|
*/
|
||||||
|
offers: NFTSellOffer[]
|
||||||
|
/**
|
||||||
|
* The token ID of the NFToken to which these offers pertain.
|
||||||
|
*/
|
||||||
|
tokenid: string
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,10 +52,6 @@ export interface NFTokenMintFlagsInterface extends GlobalFlags {
|
|||||||
*/
|
*/
|
||||||
export interface NFTokenMint extends BaseTransaction {
|
export interface NFTokenMint extends BaseTransaction {
|
||||||
TransactionType: 'NFTokenMint'
|
TransactionType: 'NFTokenMint'
|
||||||
/**
|
|
||||||
* Indicates the account that is minting the token.
|
|
||||||
*/
|
|
||||||
Account: string
|
|
||||||
/**
|
/**
|
||||||
* Indicates the taxon associated with this token. The taxon is generally a
|
* Indicates the taxon associated with this token. The taxon is generally a
|
||||||
* value chosen by the minter of the token and a given taxon may be used for
|
* value chosen by the minter of the token and a given taxon may be used for
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ export interface AccountSet extends BaseTransaction {
|
|||||||
* digits. Valid values are 3 to 15 inclusive, or 0 to disable.
|
* digits. Valid values are 3 to 15 inclusive, or 0 to disable.
|
||||||
*/
|
*/
|
||||||
TickSize?: number
|
TickSize?: number
|
||||||
|
/**
|
||||||
|
* TODO check
|
||||||
|
* Sets an alternate account that is allowed to mint NFTokens on this
|
||||||
|
* account's behalf using NFTokenMint's `Issuer` field.
|
||||||
|
*/
|
||||||
|
Minter?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const MIN_TICK_SIZE = 3
|
const MIN_TICK_SIZE = 3
|
||||||
|
|||||||
Reference in New Issue
Block a user