mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-25 14:45:48 +00:00
feat(types): Export most of the types (#2360)
Expose most of the types in the `xrpl` package. Some renames will only affect you if you were deep importing these types previously. Renames of deep importable types: - `methods/bookOffers`: `TakerAmount` -> `BookOfferCurrency` - `methods/accountLines`: `Trustline` -> `AccountLinesTrustline`
This commit is contained in:
@@ -16,6 +16,13 @@ Subscribe to [the **xrpl-announce** mailing list](https://groups.google.com/g/xr
|
|||||||
* Add the new fields for `XRPFees` amendment and id for the `FeeSettings`
|
* Add the new fields for `XRPFees` amendment and id for the `FeeSettings`
|
||||||
* Add `FeeSettings`, `NegativeUNL`, and `Amendments` singleton ledger entry ids.
|
* Add `FeeSettings`, `NegativeUNL`, and `Amendments` singleton ledger entry ids.
|
||||||
* Add `WalletLocator` to `SignerEntry` on `SignerList` (LedgerEntry).
|
* Add `WalletLocator` to `SignerEntry` on `SignerList` (LedgerEntry).
|
||||||
|
* Export many nested types and interfaces
|
||||||
|
|
||||||
|
### Breaking
|
||||||
|
* If you were deep importing these types previously you will need to import them from `xrpl` and rename them:
|
||||||
|
* `methods/accountLines`: `Trustline` -> `AccountLinesTrustline`
|
||||||
|
* `methods/bookOffers`: `TakerAmount` -> `BookOfferCurrency`
|
||||||
|
* `methods/ledgerData`: `BinaryLedgerEntry` -> `LedgerDataBinaryLedgerEntry`
|
||||||
|
|
||||||
## 2.8.0 (2023-06-13)
|
## 2.8.0 (2023-06-13)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { decode } from 'ripple-binary-codec'
|
|||||||
import type {
|
import type {
|
||||||
AccountTxResponse,
|
AccountTxResponse,
|
||||||
Response,
|
Response,
|
||||||
|
ResponseWarning,
|
||||||
TransactionEntryResponse,
|
TransactionEntryResponse,
|
||||||
TransactionStream,
|
TransactionStream,
|
||||||
TxResponse,
|
TxResponse,
|
||||||
@@ -111,7 +112,7 @@ export function handlePartialPayment(
|
|||||||
response: Response,
|
response: Response,
|
||||||
): void {
|
): void {
|
||||||
if (hasPartialPayment(command, response)) {
|
if (hasPartialPayment(command, response)) {
|
||||||
const warnings = response.warnings ?? []
|
const warnings: ResponseWarning[] = response.warnings ?? []
|
||||||
|
|
||||||
const warning = {
|
const warning = {
|
||||||
id: WARN_PARTIAL_PAYMENT_CODE,
|
id: WARN_PARTIAL_PAYMENT_CODE,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export * from './models'
|
|||||||
|
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
|
|
||||||
|
export { default as ECDSA } from './ECDSA'
|
||||||
|
|
||||||
export * from './errors'
|
export * from './errors'
|
||||||
|
|
||||||
export { Wallet } from './Wallet'
|
export { Wallet } from './Wallet'
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export type LedgerIndex = number | ('validated' | 'closed' | 'current')
|
export type LedgerIndex = number | ('validated' | 'closed' | 'current')
|
||||||
|
|
||||||
interface XRP {
|
export interface XRP {
|
||||||
currency: 'XRP'
|
currency: 'XRP'
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IssuedCurrency {
|
export interface IssuedCurrency {
|
||||||
currency: string
|
currency: string
|
||||||
issuer: string
|
issuer: string
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ export type StreamType =
|
|||||||
| 'server'
|
| 'server'
|
||||||
| 'validations'
|
| 'validations'
|
||||||
|
|
||||||
interface PathStep {
|
export interface PathStep {
|
||||||
account?: string
|
account?: string
|
||||||
currency?: string
|
currency?: string
|
||||||
issuer?: string
|
issuer?: string
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ export {
|
|||||||
} from './utils/flags'
|
} from './utils/flags'
|
||||||
export * from './methods'
|
export * from './methods'
|
||||||
export * from './transactions'
|
export * from './transactions'
|
||||||
|
export * from './common'
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import BaseLedgerEntry from './BaseLedgerEntry'
|
|||||||
export const AMENDMENTS_ID =
|
export const AMENDMENTS_ID =
|
||||||
'7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4'
|
'7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4'
|
||||||
|
|
||||||
interface Majority {
|
export interface Majority {
|
||||||
Majority: {
|
Majority: {
|
||||||
/** The Amendment ID of the pending amendment. */
|
/** The Amendment ID of the pending amendment. */
|
||||||
Amendment: string
|
Amendment: string
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
import BaseLedgerEntry from './BaseLedgerEntry'
|
||||||
|
|
||||||
export interface NFToken {
|
export interface NFToken {
|
||||||
Flags: number
|
NFToken: {
|
||||||
Issuer: string
|
Flags: number
|
||||||
NFTokenID: string
|
Issuer: string
|
||||||
NFTokenTaxon: number
|
NFTokenID: string
|
||||||
URI?: string
|
NFTokenTaxon: number
|
||||||
}
|
URI?: string
|
||||||
|
}
|
||||||
export interface NFTokenWrapper {
|
|
||||||
NFToken: NFToken
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NFTokenPage extends BaseLedgerEntry {
|
export interface NFTokenPage extends BaseLedgerEntry {
|
||||||
LedgerEntryType: 'NFTokenPage'
|
LedgerEntryType: 'NFTokenPage'
|
||||||
NextPageMin?: string
|
NextPageMin?: string
|
||||||
NFTokens: NFTokenWrapper[]
|
NFTokens: NFToken[]
|
||||||
PreviousPageMin?: string
|
PreviousPageMin?: string
|
||||||
PreviousTxnID?: string
|
PreviousTxnID?: string
|
||||||
PreviousTxnLgrSeq?: number
|
PreviousTxnLgrSeq?: number
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ import BaseLedgerEntry from './BaseLedgerEntry'
|
|||||||
export const NEGATIVE_UNL_ID =
|
export const NEGATIVE_UNL_ID =
|
||||||
'2E8A59AA9D3B5B186B0B9E0F62E6C02587CA74A4D778938E957B6357D364B244'
|
'2E8A59AA9D3B5B186B0B9E0F62E6C02587CA74A4D778938E957B6357D364B244'
|
||||||
|
|
||||||
interface DisabledValidator {
|
|
||||||
FirstLedgerSequence: number
|
|
||||||
PublicKey: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The NegativeUNL object type contains the current status of the Negative UNL,
|
* The NegativeUNL object type contains the current status of the Negative UNL,
|
||||||
* a list of trusted validators currently believed to be offline.
|
* a list of trusted validators currently believed to be offline.
|
||||||
@@ -22,7 +17,10 @@ export default interface NegativeUNL extends BaseLedgerEntry {
|
|||||||
/**
|
/**
|
||||||
* A list of trusted validators that are currently disabled.
|
* A list of trusted validators that are currently disabled.
|
||||||
*/
|
*/
|
||||||
DisabledValidators?: DisabledValidator[]
|
DisabledValidators?: Array<{
|
||||||
|
FirstLedgerSequence: number
|
||||||
|
PublicKey: string
|
||||||
|
}>
|
||||||
/**
|
/**
|
||||||
* The public key of a trusted validator that is scheduled to be disabled in
|
* The public key of a trusted validator that is scheduled to be disabled in
|
||||||
* the next flag ledger.
|
* the next flag ledger.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import AccountRoot, {
|
|||||||
AccountRootFlags,
|
AccountRootFlags,
|
||||||
AccountRootFlagsInterface,
|
AccountRootFlagsInterface,
|
||||||
} from './AccountRoot'
|
} from './AccountRoot'
|
||||||
import Amendments, { AMENDMENTS_ID } from './Amendments'
|
import Amendments, { Majority, AMENDMENTS_ID } from './Amendments'
|
||||||
import Check from './Check'
|
import Check from './Check'
|
||||||
import DepositPreauth from './DepositPreauth'
|
import DepositPreauth from './DepositPreauth'
|
||||||
import DirectoryNode from './DirectoryNode'
|
import DirectoryNode from './DirectoryNode'
|
||||||
@@ -41,6 +41,7 @@ export {
|
|||||||
Ledger,
|
Ledger,
|
||||||
LedgerEntry,
|
LedgerEntry,
|
||||||
LedgerHashes,
|
LedgerHashes,
|
||||||
|
Majority,
|
||||||
NEGATIVE_UNL_ID,
|
NEGATIVE_UNL_ID,
|
||||||
NegativeUNL,
|
NegativeUNL,
|
||||||
NFTokenOffer,
|
NFTokenOffer,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
||||||
|
|
||||||
interface Channel {
|
export interface Channel {
|
||||||
account: string
|
account: string
|
||||||
amount: string
|
amount: string
|
||||||
balance: string
|
balance: string
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export interface AccountInfoRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
strict?: boolean
|
strict?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QueueTransaction {
|
export interface AccountQueueTransaction {
|
||||||
/**
|
/**
|
||||||
* Whether this transaction changes this address's ways of authorizing
|
* Whether this transaction changes this address's ways of authorizing
|
||||||
* transactions.
|
* transactions.
|
||||||
@@ -50,7 +50,7 @@ interface QueueTransaction {
|
|||||||
seq: number
|
seq: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QueueData {
|
export interface AccountQueueData {
|
||||||
/** Number of queued transactions from this address. */
|
/** Number of queued transactions from this address. */
|
||||||
txn_count: number
|
txn_count: number
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +70,7 @@ interface QueueData {
|
|||||||
*/
|
*/
|
||||||
max_spend_drops_total?: string
|
max_spend_drops_total?: string
|
||||||
/** Information about each queued transaction from this address. */
|
/** Information about each queued transaction from this address. */
|
||||||
transactions?: QueueTransaction[]
|
transactions?: AccountQueueTransaction[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AccountInfoAccountFlags {
|
export interface AccountInfoAccountFlags {
|
||||||
@@ -168,7 +168,7 @@ export interface AccountInfoResponse extends BaseResponse {
|
|||||||
* fields may be omitted because the values are calculated "lazily" by the
|
* fields may be omitted because the values are calculated "lazily" by the
|
||||||
* queuing mechanism.
|
* queuing mechanism.
|
||||||
*/
|
*/
|
||||||
queue_data?: QueueData
|
queue_data?: AccountQueueData
|
||||||
/**
|
/**
|
||||||
* True if this data is from a validated ledger version; if omitted or set
|
* True if this data is from a validated ledger version; if omitted or set
|
||||||
* to false, this data is not final.
|
* to false, this data is not final.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
||||||
|
|
||||||
export interface Trustline {
|
export interface AccountLinesTrustline {
|
||||||
/** The unique Address of the counterparty to this trust line. */
|
/** The unique Address of the counterparty to this trust line. */
|
||||||
account: string
|
account: string
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +111,7 @@ export interface AccountLinesResponse extends BaseResponse {
|
|||||||
* Array of trust line objects. If the number of trust lines is large, only
|
* Array of trust line objects. If the number of trust lines is large, only
|
||||||
* returns up to the limit at a time.
|
* returns up to the limit at a time.
|
||||||
*/
|
*/
|
||||||
lines: Trustline[]
|
lines: AccountLinesTrustline[]
|
||||||
/**
|
/**
|
||||||
* The ledger index of the current open ledger, which was used when
|
* The ledger index of the current open ledger, which was used when
|
||||||
* retrieving this information.
|
* retrieving this information.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
|
|
||||||
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
||||||
|
|
||||||
type AccountObjectType =
|
export type AccountObjectType =
|
||||||
| 'check'
|
| 'check'
|
||||||
| 'deposit_preauth'
|
| 'deposit_preauth'
|
||||||
| 'escrow'
|
| 'escrow'
|
||||||
@@ -63,7 +63,7 @@ export interface AccountObjectsRequest
|
|||||||
* Account Objects can be a Check, a DepositPreauth, an Escrow, an Offer, a
|
* Account Objects can be a Check, a DepositPreauth, an Escrow, an Offer, a
|
||||||
* PayChannel, a SignerList, a Ticket, or a RippleState.
|
* PayChannel, a SignerList, a Ticket, or a RippleState.
|
||||||
*/
|
*/
|
||||||
type AccountObject =
|
export type AccountObject =
|
||||||
| Check
|
| Check
|
||||||
| DepositPreauth
|
| DepositPreauth
|
||||||
| Escrow
|
| Escrow
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export interface AccountTxRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
marker?: unknown
|
marker?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AccountTransaction {
|
export interface AccountTxTransaction {
|
||||||
/** The ledger index of the ledger version that included this transaction. */
|
/** The ledger index of the ledger version that included this transaction. */
|
||||||
ledger_index: number
|
ledger_index: number
|
||||||
/**
|
/**
|
||||||
@@ -98,7 +98,7 @@ export interface AccountTxResponse extends BaseResponse {
|
|||||||
* Array of transactions matching the request's criteria, as explained
|
* Array of transactions matching the request's criteria, as explained
|
||||||
* below.
|
* below.
|
||||||
*/
|
*/
|
||||||
transactions: AccountTransaction[]
|
transactions: AccountTxTransaction[]
|
||||||
/**
|
/**
|
||||||
* If included and set to true, the information in this response comes from
|
* If included and set to true, the information in this response comes from
|
||||||
* a validated ledger version. Otherwise, the information is subject to
|
* a validated ledger version. Otherwise, the information is subject to
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export interface LookupByLedgerRequest {
|
|||||||
ledger_index?: LedgerIndex
|
ledger_index?: LedgerIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Warning {
|
export interface ResponseWarning {
|
||||||
id: number
|
id: number
|
||||||
message: string
|
message: string
|
||||||
details?: { [key: string]: string }
|
details?: { [key: string]: string }
|
||||||
@@ -35,7 +35,7 @@ export interface BaseResponse {
|
|||||||
type: 'response' | string
|
type: 'response' | string
|
||||||
result: unknown
|
result: unknown
|
||||||
warning?: 'load'
|
warning?: 'load'
|
||||||
warnings?: Warning[]
|
warnings?: ResponseWarning[]
|
||||||
forwarded?: boolean
|
forwarded?: boolean
|
||||||
api_version?: number
|
api_version?: number
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Offer } from '../ledger'
|
|||||||
|
|
||||||
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
||||||
|
|
||||||
export interface TakerAmount {
|
export interface BookOfferCurrency {
|
||||||
currency: string
|
currency: string
|
||||||
issuer?: string
|
issuer?: string
|
||||||
}
|
}
|
||||||
@@ -32,13 +32,13 @@ export interface BookOffersRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
* receive, as an object with currency and issuer fields (omit issuer for
|
* receive, as an object with currency and issuer fields (omit issuer for
|
||||||
* XRP), like currency amounts.
|
* XRP), like currency amounts.
|
||||||
*/
|
*/
|
||||||
taker_gets: TakerAmount
|
taker_gets: BookOfferCurrency
|
||||||
/**
|
/**
|
||||||
* Specification of which currency the account taking the offer would pay, as
|
* Specification of which currency the account taking the offer would pay, as
|
||||||
* an object with currency and issuer fields (omit issuer for XRP), like
|
* an object with currency and issuer fields (omit issuer for XRP), like
|
||||||
* currency amounts.
|
* currency amounts.
|
||||||
*/
|
*/
|
||||||
taker_pays: TakerAmount
|
taker_pays: BookOfferCurrency
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BookOffer extends Offer {
|
export interface BookOffer extends Offer {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export interface GatewayBalancesRequest
|
|||||||
hotwallet?: string | string[]
|
hotwallet?: string | string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Balance {
|
export interface GatewayBalance {
|
||||||
currency: string
|
currency: string
|
||||||
value: string
|
value: string
|
||||||
}
|
}
|
||||||
@@ -60,12 +60,12 @@ export interface GatewayBalancesResponse extends BaseResponse {
|
|||||||
* Amounts issued to the hotwallet addresses from the request. The keys are
|
* Amounts issued to the hotwallet addresses from the request. The keys are
|
||||||
* addresses and the values are arrays of currency amounts they hold.
|
* addresses and the values are arrays of currency amounts they hold.
|
||||||
*/
|
*/
|
||||||
balances?: { [address: string]: Balance[] }
|
balances?: { [address: string]: GatewayBalance[] }
|
||||||
/**
|
/**
|
||||||
* Total amounts held that are issued by others. In the recommended
|
* Total amounts held that are issued by others. In the recommended
|
||||||
* configuration, the issuing address should have none.
|
* configuration, the issuing address should have none.
|
||||||
*/
|
*/
|
||||||
assets?: { [address: string]: Balance[] }
|
assets?: { [address: string]: GatewayBalance[] }
|
||||||
/**
|
/**
|
||||||
* The identifying hash of the ledger version that was used to generate
|
* The identifying hash of the ledger version that was used to generate
|
||||||
* this response.
|
* this response.
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
/* eslint-disable max-lines -- There is a lot to export */
|
||||||
import {
|
import {
|
||||||
AccountChannelsRequest,
|
AccountChannelsRequest,
|
||||||
AccountChannelsResponse,
|
AccountChannelsResponse,
|
||||||
|
Channel,
|
||||||
} from './accountChannels'
|
} from './accountChannels'
|
||||||
import {
|
import {
|
||||||
AccountCurrenciesRequest,
|
AccountCurrenciesRequest,
|
||||||
@@ -10,18 +12,47 @@ import {
|
|||||||
AccountInfoAccountFlags,
|
AccountInfoAccountFlags,
|
||||||
AccountInfoRequest,
|
AccountInfoRequest,
|
||||||
AccountInfoResponse,
|
AccountInfoResponse,
|
||||||
|
AccountQueueData,
|
||||||
|
AccountQueueTransaction,
|
||||||
} from './accountInfo'
|
} from './accountInfo'
|
||||||
import { AccountLinesRequest, AccountLinesResponse } from './accountLines'
|
import {
|
||||||
import { AccountNFTsRequest, AccountNFTsResponse } from './accountNFTs'
|
AccountLinesRequest,
|
||||||
import { AccountObjectsRequest, AccountObjectsResponse } from './accountObjects'
|
AccountLinesResponse,
|
||||||
|
AccountLinesTrustline,
|
||||||
|
} from './accountLines'
|
||||||
|
import {
|
||||||
|
AccountNFToken,
|
||||||
|
AccountNFTsRequest,
|
||||||
|
AccountNFTsResponse,
|
||||||
|
} from './accountNFTs'
|
||||||
|
import {
|
||||||
|
AccountObject,
|
||||||
|
AccountObjectsRequest,
|
||||||
|
AccountObjectsResponse,
|
||||||
|
AccountObjectType,
|
||||||
|
} from './accountObjects'
|
||||||
import {
|
import {
|
||||||
AccountOffer,
|
AccountOffer,
|
||||||
AccountOffersRequest,
|
AccountOffersRequest,
|
||||||
AccountOffersResponse,
|
AccountOffersResponse,
|
||||||
} from './accountOffers'
|
} from './accountOffers'
|
||||||
import { AccountTxRequest, AccountTxResponse } from './accountTx'
|
import {
|
||||||
import { ErrorResponse } from './baseMethod'
|
AccountTxRequest,
|
||||||
import { BookOffersRequest, BookOffer, BookOffersResponse } from './bookOffers'
|
AccountTxResponse,
|
||||||
|
AccountTxTransaction,
|
||||||
|
} from './accountTx'
|
||||||
|
import {
|
||||||
|
BaseRequest,
|
||||||
|
BaseResponse,
|
||||||
|
ErrorResponse,
|
||||||
|
ResponseWarning,
|
||||||
|
} from './baseMethod'
|
||||||
|
import {
|
||||||
|
BookOffersRequest,
|
||||||
|
BookOffer,
|
||||||
|
BookOffersResponse,
|
||||||
|
BookOfferCurrency,
|
||||||
|
} from './bookOffers'
|
||||||
import { ChannelVerifyRequest, ChannelVerifyResponse } from './channelVerify'
|
import { ChannelVerifyRequest, ChannelVerifyResponse } from './channelVerify'
|
||||||
import {
|
import {
|
||||||
DepositAuthorizedRequest,
|
DepositAuthorizedRequest,
|
||||||
@@ -29,17 +60,34 @@ import {
|
|||||||
} from './depositAuthorized'
|
} from './depositAuthorized'
|
||||||
import { FeeRequest, FeeResponse } from './fee'
|
import { FeeRequest, FeeResponse } from './fee'
|
||||||
import {
|
import {
|
||||||
|
GatewayBalance,
|
||||||
GatewayBalancesRequest,
|
GatewayBalancesRequest,
|
||||||
GatewayBalancesResponse,
|
GatewayBalancesResponse,
|
||||||
} from './gatewayBalances'
|
} from './gatewayBalances'
|
||||||
import { LedgerRequest, LedgerResponse } from './ledger'
|
import {
|
||||||
|
LedgerBinary,
|
||||||
|
LedgerModifiedOfferCreateTransaction,
|
||||||
|
LedgerQueueData,
|
||||||
|
LedgerRequest,
|
||||||
|
LedgerResponse,
|
||||||
|
} from './ledger'
|
||||||
import { LedgerClosedRequest, LedgerClosedResponse } from './ledgerClosed'
|
import { LedgerClosedRequest, LedgerClosedResponse } from './ledgerClosed'
|
||||||
import { LedgerCurrentRequest, LedgerCurrentResponse } from './ledgerCurrent'
|
import { LedgerCurrentRequest, LedgerCurrentResponse } from './ledgerCurrent'
|
||||||
import { LedgerDataRequest, LedgerDataResponse } from './ledgerData'
|
import {
|
||||||
|
LedgerDataBinaryLedgerEntry,
|
||||||
|
LedgerDataLabeledLedgerEntry,
|
||||||
|
LedgerDataLedgerState,
|
||||||
|
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 { NFTBuyOffersRequest, NFTBuyOffersResponse } from './nftBuyOffers'
|
||||||
import { NFTHistoryRequest, NFTHistoryResponse } from './nftHistory'
|
import {
|
||||||
|
NFTHistoryRequest,
|
||||||
|
NFTHistoryResponse,
|
||||||
|
NFTHistoryTransaction,
|
||||||
|
} from './nftHistory'
|
||||||
import { NFTInfoRequest, NFTInfoResponse } from './nftInfo'
|
import { NFTInfoRequest, NFTInfoResponse } from './nftInfo'
|
||||||
import { NFTSellOffersRequest, NFTSellOffersResponse } from './nftSellOffers'
|
import { NFTSellOffersRequest, NFTSellOffersResponse } from './nftSellOffers'
|
||||||
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
|
import { NoRippleCheckRequest, NoRippleCheckResponse } from './norippleCheck'
|
||||||
@@ -49,11 +97,24 @@ import {
|
|||||||
PathFindCreateRequest,
|
PathFindCreateRequest,
|
||||||
PathFindStatusRequest,
|
PathFindStatusRequest,
|
||||||
PathFindResponse,
|
PathFindResponse,
|
||||||
|
PathFindPathOption,
|
||||||
} from './pathFind'
|
} from './pathFind'
|
||||||
import { PingRequest, PingResponse } from './ping'
|
import { PingRequest, PingResponse } from './ping'
|
||||||
import { RandomRequest, RandomResponse } from './random'
|
import { RandomRequest, RandomResponse } from './random'
|
||||||
import { RipplePathFindRequest, RipplePathFindResponse } from './ripplePathFind'
|
import {
|
||||||
import { ServerInfoRequest, ServerInfoResponse } from './serverInfo'
|
RipplePathFindPathOption,
|
||||||
|
RipplePathFindRequest,
|
||||||
|
RipplePathFindResponse,
|
||||||
|
SourceCurrencyAmount,
|
||||||
|
} from './ripplePathFind'
|
||||||
|
import {
|
||||||
|
JobType,
|
||||||
|
ServerInfoRequest,
|
||||||
|
ServerInfoResponse,
|
||||||
|
ServerState,
|
||||||
|
StateAccounting,
|
||||||
|
StateAccountingFinal,
|
||||||
|
} from './serverInfo'
|
||||||
import { ServerStateRequest, ServerStateResponse } from './serverState'
|
import { ServerStateRequest, ServerStateResponse } from './serverState'
|
||||||
import { SubmitRequest, SubmitResponse } from './submit'
|
import { SubmitRequest, SubmitResponse } from './submit'
|
||||||
import {
|
import {
|
||||||
@@ -61,12 +122,15 @@ import {
|
|||||||
SubmitMultisignedResponse,
|
SubmitMultisignedResponse,
|
||||||
} from './submitMultisigned'
|
} from './submitMultisigned'
|
||||||
import {
|
import {
|
||||||
|
BooksSnapshot,
|
||||||
ConsensusStream,
|
ConsensusStream,
|
||||||
LedgerStream,
|
LedgerStream,
|
||||||
|
LedgerStreamResponse,
|
||||||
OrderBookStream,
|
OrderBookStream,
|
||||||
PathFindStream,
|
PathFindStream,
|
||||||
PeerStatusStream,
|
PeerStatusStream,
|
||||||
Stream,
|
Stream,
|
||||||
|
SubscribeBook,
|
||||||
SubscribeRequest,
|
SubscribeRequest,
|
||||||
SubscribeResponse,
|
SubscribeResponse,
|
||||||
TransactionStream,
|
TransactionStream,
|
||||||
@@ -77,7 +141,11 @@ import {
|
|||||||
TransactionEntryResponse,
|
TransactionEntryResponse,
|
||||||
} from './transactionEntry'
|
} from './transactionEntry'
|
||||||
import { TxRequest, TxResponse } from './tx'
|
import { TxRequest, TxResponse } from './tx'
|
||||||
import { UnsubscribeRequest, UnsubscribeResponse } from './unsubscribe'
|
import {
|
||||||
|
UnsubscribeBook,
|
||||||
|
UnsubscribeRequest,
|
||||||
|
UnsubscribeResponse,
|
||||||
|
} from './unsubscribe'
|
||||||
/**
|
/**
|
||||||
* @category Requests
|
* @category Requests
|
||||||
*/
|
*/
|
||||||
@@ -181,9 +249,14 @@ type Response =
|
|||||||
| NFTHistoryResponse
|
| NFTHistoryResponse
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
// Allow users to define their own requests and responses. This is useful for releasing experimental versions
|
||||||
|
BaseRequest,
|
||||||
|
BaseResponse,
|
||||||
Request,
|
Request,
|
||||||
Response,
|
Response,
|
||||||
// account methods
|
ResponseWarning,
|
||||||
|
// account methods with types
|
||||||
|
Channel,
|
||||||
AccountChannelsRequest,
|
AccountChannelsRequest,
|
||||||
AccountChannelsResponse,
|
AccountChannelsResponse,
|
||||||
AccountCurrenciesRequest,
|
AccountCurrenciesRequest,
|
||||||
@@ -191,10 +264,16 @@ export {
|
|||||||
AccountInfoAccountFlags,
|
AccountInfoAccountFlags,
|
||||||
AccountInfoRequest,
|
AccountInfoRequest,
|
||||||
AccountInfoResponse,
|
AccountInfoResponse,
|
||||||
|
AccountQueueData,
|
||||||
|
AccountQueueTransaction,
|
||||||
AccountLinesRequest,
|
AccountLinesRequest,
|
||||||
AccountLinesResponse,
|
AccountLinesResponse,
|
||||||
|
AccountLinesTrustline,
|
||||||
|
AccountNFToken,
|
||||||
AccountNFTsRequest,
|
AccountNFTsRequest,
|
||||||
AccountNFTsResponse,
|
AccountNFTsResponse,
|
||||||
|
AccountObject,
|
||||||
|
AccountObjectType,
|
||||||
AccountObjectsRequest,
|
AccountObjectsRequest,
|
||||||
AccountObjectsResponse,
|
AccountObjectsResponse,
|
||||||
AccountOffer,
|
AccountOffer,
|
||||||
@@ -202,6 +281,8 @@ export {
|
|||||||
AccountOffersResponse,
|
AccountOffersResponse,
|
||||||
AccountTxRequest,
|
AccountTxRequest,
|
||||||
AccountTxResponse,
|
AccountTxResponse,
|
||||||
|
AccountTxTransaction,
|
||||||
|
GatewayBalance,
|
||||||
GatewayBalancesRequest,
|
GatewayBalancesRequest,
|
||||||
GatewayBalancesResponse,
|
GatewayBalancesResponse,
|
||||||
NoRippleCheckRequest,
|
NoRippleCheckRequest,
|
||||||
@@ -209,15 +290,21 @@ export {
|
|||||||
// ledger methods
|
// ledger methods
|
||||||
LedgerRequest,
|
LedgerRequest,
|
||||||
LedgerResponse,
|
LedgerResponse,
|
||||||
|
LedgerQueueData,
|
||||||
|
LedgerBinary,
|
||||||
|
LedgerModifiedOfferCreateTransaction,
|
||||||
LedgerClosedRequest,
|
LedgerClosedRequest,
|
||||||
LedgerClosedResponse,
|
LedgerClosedResponse,
|
||||||
LedgerCurrentRequest,
|
LedgerCurrentRequest,
|
||||||
LedgerCurrentResponse,
|
LedgerCurrentResponse,
|
||||||
LedgerDataRequest,
|
LedgerDataRequest,
|
||||||
|
LedgerDataLabeledLedgerEntry,
|
||||||
|
LedgerDataBinaryLedgerEntry,
|
||||||
LedgerDataResponse,
|
LedgerDataResponse,
|
||||||
|
LedgerDataLedgerState,
|
||||||
LedgerEntryRequest,
|
LedgerEntryRequest,
|
||||||
LedgerEntryResponse,
|
LedgerEntryResponse,
|
||||||
// transaction methods
|
// transaction methods with types
|
||||||
SubmitRequest,
|
SubmitRequest,
|
||||||
SubmitResponse,
|
SubmitResponse,
|
||||||
SubmitMultisignedRequest,
|
SubmitMultisignedRequest,
|
||||||
@@ -226,27 +313,34 @@ export {
|
|||||||
TransactionEntryResponse,
|
TransactionEntryResponse,
|
||||||
TxRequest,
|
TxRequest,
|
||||||
TxResponse,
|
TxResponse,
|
||||||
// path and order book methods
|
// path and order book methods with types
|
||||||
BookOffersRequest,
|
BookOffersRequest,
|
||||||
BookOffer,
|
BookOffer,
|
||||||
|
BookOfferCurrency,
|
||||||
BookOffersResponse,
|
BookOffersResponse,
|
||||||
DepositAuthorizedRequest,
|
DepositAuthorizedRequest,
|
||||||
DepositAuthorizedResponse,
|
DepositAuthorizedResponse,
|
||||||
PathFindRequest,
|
PathFindRequest,
|
||||||
PathFindCreateRequest,
|
PathFindCreateRequest,
|
||||||
PathFindCloseRequest,
|
PathFindCloseRequest,
|
||||||
|
PathFindPathOption,
|
||||||
PathFindStatusRequest,
|
PathFindStatusRequest,
|
||||||
PathFindResponse,
|
PathFindResponse,
|
||||||
|
RipplePathFindPathOption,
|
||||||
RipplePathFindRequest,
|
RipplePathFindRequest,
|
||||||
RipplePathFindResponse,
|
RipplePathFindResponse,
|
||||||
|
SourceCurrencyAmount,
|
||||||
// payment channel methods
|
// payment channel methods
|
||||||
ChannelVerifyRequest,
|
ChannelVerifyRequest,
|
||||||
ChannelVerifyResponse,
|
ChannelVerifyResponse,
|
||||||
// Subscribe methods/streams
|
// Subscribe methods/streams with types
|
||||||
SubscribeRequest,
|
SubscribeRequest,
|
||||||
SubscribeResponse,
|
SubscribeResponse,
|
||||||
|
SubscribeBook,
|
||||||
Stream,
|
Stream,
|
||||||
|
BooksSnapshot,
|
||||||
LedgerStream,
|
LedgerStream,
|
||||||
|
LedgerStreamResponse,
|
||||||
ValidationStream,
|
ValidationStream,
|
||||||
TransactionStream,
|
TransactionStream,
|
||||||
PathFindStream,
|
PathFindStream,
|
||||||
@@ -255,7 +349,8 @@ export {
|
|||||||
ConsensusStream,
|
ConsensusStream,
|
||||||
UnsubscribeRequest,
|
UnsubscribeRequest,
|
||||||
UnsubscribeResponse,
|
UnsubscribeResponse,
|
||||||
// server info methods
|
UnsubscribeBook,
|
||||||
|
// server info methods with types
|
||||||
FeeRequest,
|
FeeRequest,
|
||||||
FeeResponse,
|
FeeResponse,
|
||||||
ManifestRequest,
|
ManifestRequest,
|
||||||
@@ -264,6 +359,10 @@ export {
|
|||||||
ServerInfoResponse,
|
ServerInfoResponse,
|
||||||
ServerStateRequest,
|
ServerStateRequest,
|
||||||
ServerStateResponse,
|
ServerStateResponse,
|
||||||
|
JobType,
|
||||||
|
ServerState,
|
||||||
|
StateAccountingFinal,
|
||||||
|
StateAccounting,
|
||||||
// utility methods
|
// utility methods
|
||||||
PingRequest,
|
PingRequest,
|
||||||
PingResponse,
|
PingResponse,
|
||||||
@@ -280,4 +379,5 @@ export {
|
|||||||
NFTInfoResponse,
|
NFTInfoResponse,
|
||||||
NFTHistoryRequest,
|
NFTHistoryRequest,
|
||||||
NFTHistoryResponse,
|
NFTHistoryResponse,
|
||||||
|
NFTHistoryTransaction,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,20 +67,19 @@ export interface LedgerRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
queue?: boolean
|
queue?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ModifiedMetadata extends TransactionMetadata {
|
/**
|
||||||
owner_funds: string
|
* Special case transaction definition when the request contains `owner_funds: true`.
|
||||||
}
|
*/
|
||||||
|
export interface LedgerModifiedOfferCreateTransaction {
|
||||||
interface ModifiedOfferCreateTransaction {
|
|
||||||
transaction: Transaction
|
transaction: Transaction
|
||||||
metadata: ModifiedMetadata
|
metadata: TransactionMetadata & { owner_funds: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LedgerQueueData {
|
export interface LedgerQueueData {
|
||||||
account: string
|
account: string
|
||||||
tx:
|
tx:
|
||||||
| TransactionAndMetadata
|
| TransactionAndMetadata
|
||||||
| ModifiedOfferCreateTransaction
|
| LedgerModifiedOfferCreateTransaction
|
||||||
| { tx_blob: string }
|
| { tx_blob: string }
|
||||||
retries_remaining: number
|
retries_remaining: number
|
||||||
preflight_result: string
|
preflight_result: string
|
||||||
@@ -91,7 +90,7 @@ interface LedgerQueueData {
|
|||||||
max_spend_drops?: string
|
max_spend_drops?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BinaryLedger
|
export interface LedgerBinary
|
||||||
extends Omit<Omit<Ledger, 'transactions'>, 'accountState'> {
|
extends Omit<Omit<Ledger, 'transactions'>, 'accountState'> {
|
||||||
accountState?: string[]
|
accountState?: string[]
|
||||||
transactions?: string[]
|
transactions?: string[]
|
||||||
@@ -105,7 +104,7 @@ interface BinaryLedger
|
|||||||
export interface LedgerResponse extends BaseResponse {
|
export interface LedgerResponse extends BaseResponse {
|
||||||
result: {
|
result: {
|
||||||
/** The complete header data of this {@link Ledger}. */
|
/** The complete header data of this {@link Ledger}. */
|
||||||
ledger: Ledger | BinaryLedger
|
ledger: Ledger | LedgerBinary
|
||||||
/** Unique identifying hash of the entire ledger. */
|
/** Unique identifying hash of the entire ledger. */
|
||||||
ledger_hash: string
|
ledger_hash: string
|
||||||
/** The Ledger Index of this ledger. */
|
/** The Ledger Index of this ledger. */
|
||||||
|
|||||||
@@ -39,13 +39,18 @@ export interface LedgerDataRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
marker?: unknown
|
marker?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
type LabeledLedgerEntry = { ledgerEntryType: string } & LedgerEntry
|
export type LedgerDataLabeledLedgerEntry = {
|
||||||
|
ledgerEntryType: string
|
||||||
|
} & LedgerEntry
|
||||||
|
|
||||||
export interface BinaryLedgerEntry {
|
export interface LedgerDataBinaryLedgerEntry {
|
||||||
data: string
|
data: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = { index: string } & (BinaryLedgerEntry | LabeledLedgerEntry)
|
export type LedgerDataLedgerState = { index: string } & (
|
||||||
|
| LedgerDataBinaryLedgerEntry
|
||||||
|
| LedgerDataLabeledLedgerEntry
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The response expected from a {@link LedgerDataRequest}.
|
* The response expected from a {@link LedgerDataRequest}.
|
||||||
@@ -62,7 +67,7 @@ export interface LedgerDataResponse extends BaseResponse {
|
|||||||
* Array of JSON objects containing data from the ledger's state tree,
|
* Array of JSON objects containing data from the ledger's state tree,
|
||||||
* as defined below.
|
* as defined below.
|
||||||
*/
|
*/
|
||||||
state: State[]
|
state: LedgerDataLedgerState[]
|
||||||
/**
|
/**
|
||||||
* Server-defined value indicating the response is paginated. Pass this to
|
* Server-defined value indicating the response is paginated. Pass this to
|
||||||
* the next call to resume where this call left off.
|
* the next call to resume where this call left off.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export interface NFTHistoryRequest extends BaseRequest, LookupByLedgerRequest {
|
|||||||
marker?: unknown
|
marker?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NFTokenTransaction {
|
export interface NFTHistoryTransaction {
|
||||||
/** The ledger index of the ledger version that included this transaction. */
|
/** The ledger index of the ledger version that included this transaction. */
|
||||||
ledger_index: number
|
ledger_index: number
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +102,7 @@ export interface NFTHistoryResponse extends BaseResponse {
|
|||||||
* Array of transactions matching the request's criteria, as explained
|
* Array of transactions matching the request's criteria, as explained
|
||||||
* below.
|
* below.
|
||||||
*/
|
*/
|
||||||
transactions: NFTokenTransaction[]
|
transactions: NFTHistoryTransaction[]
|
||||||
/**
|
/**
|
||||||
* If included and set to true, the information in this response comes from
|
* If included and set to true, the information in this response comes from
|
||||||
* a validated ledger version. Otherwise, the information is subject to
|
* a validated ledger version. Otherwise, the information is subject to
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export type PathFindRequest =
|
|||||||
| PathFindCloseRequest
|
| PathFindCloseRequest
|
||||||
| PathFindStatusRequest
|
| PathFindStatusRequest
|
||||||
|
|
||||||
interface PathOption {
|
export interface PathFindPathOption {
|
||||||
/** Array of arrays of objects defining payment paths. */
|
/** Array of arrays of objects defining payment paths. */
|
||||||
paths_computed: Path[]
|
paths_computed: Path[]
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +82,7 @@ export interface PathFindResponse extends BaseResponse {
|
|||||||
* empty, then no paths were found connecting the source and destination
|
* empty, then no paths were found connecting the source and destination
|
||||||
* accounts.
|
* accounts.
|
||||||
*/
|
*/
|
||||||
alternatives: PathOption[]
|
alternatives: PathFindPathOption[]
|
||||||
/** Unique address of the account that would receive a transaction. */
|
/** Unique address of the account that would receive a transaction. */
|
||||||
destination_account: string
|
destination_account: string
|
||||||
/** Currency amount provided in the WebSocket request. */
|
/** Currency amount provided in the WebSocket request. */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Amount, Path } from '../common'
|
|||||||
|
|
||||||
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
|
||||||
|
|
||||||
interface SourceCurrencyAmount {
|
export interface SourceCurrencyAmount {
|
||||||
currency: string
|
currency: string
|
||||||
issuer?: string
|
issuer?: string
|
||||||
}
|
}
|
||||||
@@ -37,10 +37,10 @@ export interface RipplePathFindRequest
|
|||||||
* entry in the array should be a JSON object with a mandatory currency field
|
* entry in the array should be a JSON object with a mandatory currency field
|
||||||
* and optional issuer field, like how currency amounts are specified.
|
* and optional issuer field, like how currency amounts are specified.
|
||||||
*/
|
*/
|
||||||
source_currencies?: SourceCurrencyAmount
|
source_currencies?: SourceCurrencyAmount[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PathOption {
|
export interface RipplePathFindPathOption {
|
||||||
/** Array of arrays of objects defining payment paths. */
|
/** Array of arrays of objects defining payment paths. */
|
||||||
paths_computed: Path[]
|
paths_computed: Path[]
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +62,7 @@ export interface RipplePathFindResponse extends BaseResponse {
|
|||||||
* empty, then there are no paths connecting the source and destination
|
* empty, then there are no paths connecting the source and destination
|
||||||
* accounts.
|
* accounts.
|
||||||
*/
|
*/
|
||||||
alternatives: PathOption[]
|
alternatives: RipplePathFindPathOption[]
|
||||||
/** Unique address of the account that would receive a payment transaction. */
|
/** Unique address of the account that would receive a payment transaction. */
|
||||||
destination_account: string
|
destination_account: string
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export interface SubmitMultisignedRequest extends BaseRequest {
|
|||||||
/**
|
/**
|
||||||
* Transaction in JSON format with an array of Signers. To be successful, the
|
* Transaction in JSON format with an array of Signers. To be successful, the
|
||||||
* weights of the signatures must be equal or higher than the quorum of the.
|
* weights of the signatures must be equal or higher than the quorum of the.
|
||||||
* {@link SignerList}.
|
* {@link Transaction Type/SignerList}.
|
||||||
*/
|
*/
|
||||||
tx_json: Transaction
|
tx_json: Transaction
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { TransactionMetadata } from '../transactions/metadata'
|
|||||||
|
|
||||||
import type { BaseRequest, BaseResponse } from './baseMethod'
|
import type { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
interface Book {
|
export interface SubscribeBook {
|
||||||
/**
|
/**
|
||||||
* Specification of which currency the account taking the Offer would
|
* Specification of which currency the account taking the Offer would
|
||||||
* receive, as a currency object with no amount.
|
* receive, as a currency object with no amount.
|
||||||
@@ -60,7 +60,7 @@ export interface SubscribeRequest extends BaseRequest {
|
|||||||
* Array of objects defining order books to monitor for updates, as detailed
|
* Array of objects defining order books to monitor for updates, as detailed
|
||||||
* Below.
|
* Below.
|
||||||
*/
|
*/
|
||||||
books?: Book[]
|
books?: SubscribeBook[]
|
||||||
/**
|
/**
|
||||||
* URL where the server sends a JSON-RPC callbacks for each event.
|
* URL where the server sends a JSON-RPC callbacks for each event.
|
||||||
* Admin-only.
|
* Admin-only.
|
||||||
@@ -72,7 +72,7 @@ export interface SubscribeRequest extends BaseRequest {
|
|||||||
url_password?: string
|
url_password?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type BooksSnapshot = Offer[]
|
export type BooksSnapshot = Offer[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response expected from a {@link SubscribeRequest}.
|
* Response expected from a {@link SubscribeRequest}.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Currency, StreamType } from '../common'
|
|||||||
|
|
||||||
import type { BaseRequest, BaseResponse } from './baseMethod'
|
import type { BaseRequest, BaseResponse } from './baseMethod'
|
||||||
|
|
||||||
interface Book {
|
export interface UnsubscribeBook {
|
||||||
taker_gets: Currency
|
taker_gets: Currency
|
||||||
taker_pays: Currency
|
taker_pays: Currency
|
||||||
both?: boolean
|
both?: boolean
|
||||||
@@ -36,7 +36,7 @@ export interface UnsubscribeRequest extends BaseRequest {
|
|||||||
* Array of objects defining order books to unsubscribe from, as explained
|
* Array of objects defining order books to unsubscribe from, as explained
|
||||||
* below.
|
* below.
|
||||||
*/
|
*/
|
||||||
books?: Book[]
|
books?: UnsubscribeBook[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
export { BaseTransaction } from './common'
|
||||||
export { validate, TransactionAndMetadata, Transaction } from './transaction'
|
export { validate, TransactionAndMetadata, Transaction } from './transaction'
|
||||||
export { TransactionMetadata } from './metadata'
|
export * from './metadata'
|
||||||
export {
|
export {
|
||||||
AccountSetAsfFlags,
|
AccountSetAsfFlags,
|
||||||
AccountSetTfFlags,
|
AccountSetTfFlags,
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import flatMap from 'lodash/flatMap'
|
import flatMap from 'lodash/flatMap'
|
||||||
|
|
||||||
import type { Client } from '..'
|
import type { Client } from '..'
|
||||||
import { LedgerIndex } from '../models/common'
|
import {
|
||||||
import { AccountInfoRequest } from '../models/methods'
|
AccountLinesRequest,
|
||||||
import { AccountLinesRequest, Trustline } from '../models/methods/accountLines'
|
AccountLinesTrustline,
|
||||||
|
LedgerIndex,
|
||||||
|
AccountInfoRequest,
|
||||||
|
} from '../models'
|
||||||
import { dropsToXrp } from '../utils'
|
import { dropsToXrp } from '../utils'
|
||||||
|
|
||||||
interface Balance {
|
interface Balance {
|
||||||
@@ -12,7 +15,7 @@ interface Balance {
|
|||||||
issuer?: string
|
issuer?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBalances(trustlines: Trustline[]): Balance[] {
|
function formatBalances(trustlines: AccountLinesTrustline[]): Balance[] {
|
||||||
return trustlines.map((trustline) => ({
|
return trustlines.map((trustline) => ({
|
||||||
value: trustline.balance,
|
value: trustline.balance,
|
||||||
currency: trustline.currency,
|
currency: trustline.currency,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { LedgerIndex } from '../models/common'
|
|||||||
import { OfferFlags } from '../models/ledger/Offer'
|
import { OfferFlags } from '../models/ledger/Offer'
|
||||||
import {
|
import {
|
||||||
BookOffer,
|
BookOffer,
|
||||||
|
BookOfferCurrency,
|
||||||
BookOffersRequest,
|
BookOffersRequest,
|
||||||
TakerAmount,
|
|
||||||
} from '../models/methods/bookOffers'
|
} from '../models/methods/bookOffers'
|
||||||
|
|
||||||
const DEFAULT_LIMIT = 20
|
const DEFAULT_LIMIT = 20
|
||||||
@@ -51,8 +51,8 @@ const getOrderbookOptionsSet = new Set([
|
|||||||
// eslint-disable-next-line max-params, complexity -- Once bound to Client, getOrderbook only has 3 parameters.
|
// eslint-disable-next-line max-params, complexity -- Once bound to Client, getOrderbook only has 3 parameters.
|
||||||
async function getOrderbook(
|
async function getOrderbook(
|
||||||
this: Client,
|
this: Client,
|
||||||
currency1: TakerAmount,
|
currency1: BookOfferCurrency,
|
||||||
currency2: TakerAmount,
|
currency2: BookOfferCurrency,
|
||||||
options: {
|
options: {
|
||||||
limit?: number
|
limit?: number
|
||||||
ledger_index?: LedgerIndex
|
ledger_index?: LedgerIndex
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import flatMap from 'lodash/flatMap'
|
import flatMap from 'lodash/flatMap'
|
||||||
import { decode } from 'ripple-binary-codec'
|
import { decode } from 'ripple-binary-codec'
|
||||||
|
|
||||||
import { NFTokenWrapper } from '../models/ledger/NFTokenPage'
|
import { NFToken } from '../models/ledger/NFTokenPage'
|
||||||
import {
|
import {
|
||||||
CreatedNode,
|
CreatedNode,
|
||||||
isCreatedNode,
|
isCreatedNode,
|
||||||
@@ -74,7 +74,7 @@ export default function getNFTokenID(
|
|||||||
const previousTokenIDSet = new Set(
|
const previousTokenIDSet = new Set(
|
||||||
flatMap(affectedNodes, (node) => {
|
flatMap(affectedNodes, (node) => {
|
||||||
const nftokens = isModifiedNode(node)
|
const nftokens = isModifiedNode(node)
|
||||||
? (node.ModifiedNode.PreviousFields?.NFTokens as NFTokenWrapper[])
|
? (node.ModifiedNode.PreviousFields?.NFTokens as NFToken[])
|
||||||
: []
|
: []
|
||||||
return nftokens.map((token) => token.NFToken.NFTokenID)
|
return nftokens.map((token) => token.NFToken.NFTokenID)
|
||||||
}).filter((id) => Boolean(id)),
|
}).filter((id) => Boolean(id)),
|
||||||
@@ -84,8 +84,8 @@ export default function getNFTokenID(
|
|||||||
const finalTokenIDs = flatMap(affectedNodes, (node) =>
|
const finalTokenIDs = flatMap(affectedNodes, (node) =>
|
||||||
(
|
(
|
||||||
(((node as ModifiedNode).ModifiedNode?.FinalFields?.NFTokens ??
|
(((node as ModifiedNode).ModifiedNode?.FinalFields?.NFTokens ??
|
||||||
(node as CreatedNode).CreatedNode?.NewFields
|
(node as CreatedNode).CreatedNode?.NewFields?.NFTokens) as NFToken[]) ??
|
||||||
?.NFTokens) as NFTokenWrapper[]) ?? []
|
[]
|
||||||
).map((token) => token.NFToken.NFTokenID),
|
).map((token) => token.NFToken.NFTokenID),
|
||||||
).filter((nftokenID) => Boolean(nftokenID))
|
).filter((nftokenID) => Boolean(nftokenID))
|
||||||
/* eslint-enable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
/* eslint-enable @typescript-eslint/consistent-type-assertions -- Necessary for parsing metadata */
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
|
|
||||||
import { LedgerDataRequest } from '../../../src'
|
import { LedgerDataBinaryLedgerEntry, LedgerDataRequest } from '../../../src'
|
||||||
import type { BinaryLedgerEntry } from '../../../src/models/methods/ledgerData'
|
|
||||||
import serverUrl from '../serverUrl'
|
import serverUrl from '../serverUrl'
|
||||||
import {
|
import {
|
||||||
setupClient,
|
setupClient,
|
||||||
@@ -58,7 +57,7 @@ describe('ledger_data', function () {
|
|||||||
|
|
||||||
assert.equal(ledgerDataResponse.result.state.length, 5)
|
assert.equal(ledgerDataResponse.result.state.length, 5)
|
||||||
ledgerDataResponse.result.state.forEach((item) => {
|
ledgerDataResponse.result.state.forEach((item) => {
|
||||||
assert.typeOf((item as BinaryLedgerEntry).data, 'string')
|
assert.typeOf((item as LedgerDataBinaryLedgerEntry).data, 'string')
|
||||||
assert.typeOf(item.index, 'string')
|
assert.typeOf(item.index, 'string')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user