xrpl 4.6.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +0 -1
  2. package/build/xrpl-latest-min.js +1 -1
  3. package/build/xrpl-latest-min.js.map +1 -1
  4. package/build/xrpl-latest.js +25041 -28792
  5. package/build/xrpl-latest.js.map +1 -1
  6. package/dist/npm/Wallet/index.d.ts.map +1 -1
  7. package/dist/npm/Wallet/index.js +9 -10
  8. package/dist/npm/Wallet/index.js.map +1 -1
  9. package/dist/npm/Wallet/walletFromSecretNumbers.d.ts.map +1 -1
  10. package/dist/npm/Wallet/walletFromSecretNumbers.js.map +1 -1
  11. package/dist/npm/client/index.d.ts.map +1 -1
  12. package/dist/npm/client/index.js +14 -10
  13. package/dist/npm/client/index.js.map +1 -1
  14. package/dist/npm/models/ledger/Amendments.d.ts.map +1 -1
  15. package/dist/npm/models/ledger/DepositPreauth.d.ts.map +1 -1
  16. package/dist/npm/models/ledger/DirectoryNode.d.ts.map +1 -1
  17. package/dist/npm/models/ledger/FeeSettings.d.ts.map +1 -1
  18. package/dist/npm/models/ledger/MPToken.d.ts +1 -2
  19. package/dist/npm/models/ledger/MPToken.d.ts.map +1 -1
  20. package/dist/npm/models/ledger/NegativeUNL.d.ts.map +1 -1
  21. package/dist/npm/models/ledger/PermissionedDomain.d.ts.map +1 -1
  22. package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts.map +1 -1
  23. package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.d.ts.map +1 -1
  24. package/dist/npm/models/methods/accountChannels.d.ts.map +1 -1
  25. package/dist/npm/models/methods/accountCurrencies.d.ts.map +1 -1
  26. package/dist/npm/models/methods/accountLines.d.ts +2 -0
  27. package/dist/npm/models/methods/accountLines.d.ts.map +1 -1
  28. package/dist/npm/models/methods/accountNFTs.d.ts +4 -2
  29. package/dist/npm/models/methods/accountNFTs.d.ts.map +1 -1
  30. package/dist/npm/models/methods/accountObjects.d.ts.map +1 -1
  31. package/dist/npm/models/methods/accountOffers.d.ts.map +1 -1
  32. package/dist/npm/models/methods/ammInfo.d.ts +1 -0
  33. package/dist/npm/models/methods/ammInfo.d.ts.map +1 -1
  34. package/dist/npm/models/methods/depositAuthorized.d.ts.map +1 -1
  35. package/dist/npm/models/methods/gatewayBalances.d.ts.map +1 -1
  36. package/dist/npm/models/methods/index.d.ts +3 -3
  37. package/dist/npm/models/methods/index.d.ts.map +1 -1
  38. package/dist/npm/models/methods/ledger.d.ts.map +1 -1
  39. package/dist/npm/models/methods/ledgerEntry.d.ts +24 -5
  40. package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
  41. package/dist/npm/models/methods/nftBuyOffers.d.ts +4 -0
  42. package/dist/npm/models/methods/nftBuyOffers.d.ts.map +1 -1
  43. package/dist/npm/models/methods/nftSellOffers.d.ts +4 -0
  44. package/dist/npm/models/methods/nftSellOffers.d.ts.map +1 -1
  45. package/dist/npm/models/methods/nftsByIssuer.d.ts.map +1 -1
  46. package/dist/npm/models/methods/ripplePathFind.d.ts.map +1 -1
  47. package/dist/npm/models/methods/serverDefinitions.d.ts +16 -0
  48. package/dist/npm/models/methods/serverDefinitions.d.ts.map +1 -1
  49. package/dist/npm/models/methods/simulate.d.ts.map +1 -1
  50. package/dist/npm/models/methods/transactionEntry.d.ts.map +1 -1
  51. package/dist/npm/models/methods/tx.d.ts.map +1 -1
  52. package/dist/npm/models/methods/vaultInfo.d.ts +1 -0
  53. package/dist/npm/models/methods/vaultInfo.d.ts.map +1 -1
  54. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  55. package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
  56. package/dist/npm/utils/quality.d.ts.map +1 -1
  57. package/dist/npm/utils/quality.js +19 -8
  58. package/dist/npm/utils/quality.js.map +1 -1
  59. package/dist/npm/utils/xrpConversion.js +12 -6
  60. package/dist/npm/utils/xrpConversion.js.map +1 -1
  61. package/package.json +16 -16
  62. package/src/Wallet/index.ts +13 -12
  63. package/src/Wallet/walletFromSecretNumbers.ts +6 -4
  64. package/src/client/index.ts +36 -11
  65. package/src/models/ledger/Amendments.ts +1 -2
  66. package/src/models/ledger/DepositPreauth.ts +1 -2
  67. package/src/models/ledger/DirectoryNode.ts +1 -2
  68. package/src/models/ledger/FeeSettings.ts +1 -2
  69. package/src/models/ledger/MPToken.ts +1 -3
  70. package/src/models/ledger/NegativeUNL.ts +1 -2
  71. package/src/models/ledger/PermissionedDomain.ts +1 -2
  72. package/src/models/ledger/XChainOwnedClaimID.ts +1 -2
  73. package/src/models/ledger/XChainOwnedCreateAccountClaimID.ts +1 -2
  74. package/src/models/methods/accountChannels.ts +1 -2
  75. package/src/models/methods/accountCurrencies.ts +1 -2
  76. package/src/models/methods/accountLines.ts +12 -2
  77. package/src/models/methods/accountNFTs.ts +13 -3
  78. package/src/models/methods/accountObjects.ts +1 -2
  79. package/src/models/methods/accountOffers.ts +1 -2
  80. package/src/models/methods/ammInfo.ts +5 -0
  81. package/src/models/methods/depositAuthorized.ts +1 -2
  82. package/src/models/methods/gatewayBalances.ts +1 -2
  83. package/src/models/methods/index.ts +17 -2
  84. package/src/models/methods/ledger.ts +10 -6
  85. package/src/models/methods/ledgerEntry.ts +48 -10
  86. package/src/models/methods/nftBuyOffers.ts +20 -2
  87. package/src/models/methods/nftSellOffers.ts +20 -2
  88. package/src/models/methods/nftsByIssuer.ts +1 -2
  89. package/src/models/methods/ripplePathFind.ts +1 -2
  90. package/src/models/methods/serverDefinitions.ts +37 -0
  91. package/src/models/methods/simulate.ts +3 -2
  92. package/src/models/methods/transactionEntry.ts +1 -2
  93. package/src/models/methods/tx.ts +6 -4
  94. package/src/models/methods/vaultInfo.ts +6 -0
  95. package/src/models/transactions/MPTokenIssuanceCreate.ts +2 -2
  96. package/src/models/transactions/paymentChannelClaim.ts +2 -2
  97. package/src/utils/quality.ts +17 -11
  98. package/src/utils/xrpConversion.ts +10 -10
@@ -3,8 +3,7 @@ import { AuthorizeCredential } from '../common'
3
3
  import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
4
4
 
5
5
  export default interface PermissionedDomain
6
- extends BaseLedgerEntry,
7
- HasPreviousTxnID {
6
+ extends BaseLedgerEntry, HasPreviousTxnID {
8
7
  /* The ledger object's type (PermissionedDomain). */
9
8
  LedgerEntryType: 'PermissionedDomain'
10
9
 
@@ -10,8 +10,7 @@ import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
10
10
  * @category Ledger Entries
11
11
  */
12
12
  export default interface XChainOwnedClaimID
13
- extends BaseLedgerEntry,
14
- HasPreviousTxnID {
13
+ extends BaseLedgerEntry, HasPreviousTxnID {
15
14
  LedgerEntryType: 'XChainOwnedClaimID'
16
15
 
17
16
  /** The account that checked out this unique claim ID value. */
@@ -9,8 +9,7 @@ import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
9
9
  * @category Ledger Entries
10
10
  */
11
11
  export default interface XChainOwnedCreateAccountClaimID
12
- extends BaseLedgerEntry,
13
- HasPreviousTxnID {
12
+ extends BaseLedgerEntry, HasPreviousTxnID {
14
13
  LedgerEntryType: 'XChainOwnedCreateAccountClaimID'
15
14
 
16
15
  /** The account that owns this object. */
@@ -88,8 +88,7 @@ export interface Channel {
88
88
  * @category Requests
89
89
  */
90
90
  export interface AccountChannelsRequest
91
- extends BaseRequest,
92
- LookupByLedgerRequest {
91
+ extends BaseRequest, LookupByLedgerRequest {
93
92
  command: 'account_channels'
94
93
  /**
95
94
  * The unique identifier of an account, typically the account's address. The
@@ -8,8 +8,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
8
8
  * @category Requests
9
9
  */
10
10
  export interface AccountCurrenciesRequest
11
- extends BaseRequest,
12
- LookupByLedgerRequest {
11
+ extends BaseRequest, LookupByLedgerRequest {
13
12
  command: 'account_currencies'
14
13
  /** A unique identifier for the account, most commonly the account's address. */
15
14
  account: string
@@ -73,8 +73,7 @@ export interface AccountLinesTrustline {
73
73
  * @category Requests
74
74
  */
75
75
  export interface AccountLinesRequest
76
- extends BaseRequest,
77
- LookupByLedgerRequest {
76
+ extends BaseRequest, LookupByLedgerRequest {
78
77
  command: 'account_lines'
79
78
  /** A unique identifier for the account, most commonly the account's Address. */
80
79
  account: string
@@ -83,6 +82,11 @@ export interface AccountLinesRequest
83
82
  * connecting the two accounts.
84
83
  */
85
84
  peer?: string
85
+ /**
86
+ * If true, filter out trust lines with balances at their default values.
87
+ * The default is false.
88
+ */
89
+ ignore_default?: boolean
86
90
  /**
87
91
  * Limit the number of trust lines to retrieve. The server is not required to
88
92
  * honor this value. Must be within the inclusive range 10 to 400.
@@ -133,5 +137,11 @@ export interface AccountLinesResponse extends BaseResponse {
133
137
  * No additional pages after this one.
134
138
  */
135
139
  marker?: unknown
140
+ /**
141
+ * The maximum number of trust lines retrieved. The server may return fewer
142
+ * than the specified limit, even if more results are available. If no limit
143
+ * was specified in the request, use a default limit of 200.
144
+ */
145
+ limit?: number
136
146
  }
137
147
  }
@@ -57,9 +57,19 @@ export interface AccountNFTsResponse extends BaseResponse {
57
57
  * The ledger index of the current open ledger, which was used when
58
58
  * retrieving this information.
59
59
  */
60
- ledger_current_index: number
61
- /** If true, this data comes from a validated ledger. */
62
- validated: boolean
60
+ ledger_current_index?: number
61
+ /**
62
+ * The identifying hash of the ledger that was used to generate this response.
63
+ */
64
+ ledger_hash?: string
65
+ /**
66
+ * The ledger index of the ledger that was used to generate this response.
67
+ */
68
+ ledger_index?: number
69
+ /**
70
+ * If true, this data comes from a validated ledger.
71
+ */
72
+ validated?: boolean
63
73
  /**
64
74
  * Server-defined value indicating the response is paginated. Pass this to
65
75
  * the next call to resume where this call left off. Omitted when there are
@@ -16,8 +16,7 @@ export type AccountObjectType = Exclude<
16
16
  * @category Requests
17
17
  */
18
18
  export interface AccountObjectsRequest
19
- extends BaseRequest,
20
- LookupByLedgerRequest {
19
+ extends BaseRequest, LookupByLedgerRequest {
21
20
  command: 'account_objects'
22
21
  /** A unique identifier for the account, most commonly the account's address. */
23
22
  account: string
@@ -10,8 +10,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
10
10
  * @category Requests
11
11
  */
12
12
  export interface AccountOffersRequest
13
- extends BaseRequest,
14
- LookupByLedgerRequest {
13
+ extends BaseRequest, LookupByLedgerRequest {
15
14
  command: 'account_offers'
16
15
  /** A unique identifier for the account, most commonly the account's Address. */
17
16
  account: string
@@ -25,6 +25,11 @@ export interface AMMInfoRequest extends BaseRequest {
25
25
  * The other asset of the AMM pool.
26
26
  */
27
27
  asset2?: Currency
28
+
29
+ /**
30
+ * Show only LP Tokens held by this liquidity provider.
31
+ */
32
+ account?: string
28
33
  }
29
34
 
30
35
  /**
@@ -8,8 +8,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
8
8
  * @category Requests
9
9
  */
10
10
  export interface DepositAuthorizedRequest
11
- extends BaseRequest,
12
- LookupByLedgerRequest {
11
+ extends BaseRequest, LookupByLedgerRequest {
13
12
  command: 'deposit_authorized'
14
13
  /** The sender of a possible payment. */
15
14
  source_account: string
@@ -20,8 +20,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
20
20
  * @category Requests
21
21
  */
22
22
  export interface GatewayBalancesRequest
23
- extends BaseRequest,
24
- LookupByLedgerRequest {
23
+ extends BaseRequest, LookupByLedgerRequest {
25
24
  command: 'gateway_balances'
26
25
  /** The Address to check. This should be the issuing address. */
27
26
  account: string
@@ -108,7 +108,14 @@ import {
108
108
  LedgerDataRequest,
109
109
  LedgerDataResponse,
110
110
  } from './ledgerData'
111
- import { LedgerEntryRequest, LedgerEntryResponse } from './ledgerEntry'
111
+ import {
112
+ LedgerEntryBinaryRequest,
113
+ LedgerEntryJsonRequest,
114
+ LedgerEntryRequest,
115
+ LedgerEntryBinaryResponse,
116
+ LedgerEntryJsonResponse,
117
+ LedgerEntryResponse,
118
+ } from './ledgerEntry'
112
119
  import { ManifestRequest, ManifestResponse } from './manifest'
113
120
  import { NFTBuyOffersRequest, NFTBuyOffersResponse } from './nftBuyOffers'
114
121
  import {
@@ -412,8 +419,12 @@ export type RequestResponseMap<
412
419
  ? LedgerCurrentResponse
413
420
  : T extends LedgerDataRequest
414
421
  ? LedgerDataResponse
422
+ : T extends LedgerEntryBinaryRequest
423
+ ? LedgerEntryBinaryResponse
424
+ : T extends LedgerEntryJsonRequest
425
+ ? LedgerEntryJsonResponse
415
426
  : T extends LedgerEntryRequest
416
- ? LedgerEntryResponse
427
+ ? LedgerEntryJsonResponse
417
428
  : T extends SimulateBinaryRequest
418
429
  ? SimulateBinaryResponse
419
430
  : T extends SimulateJsonRequest
@@ -565,7 +576,11 @@ export {
565
576
  LedgerDataBinaryLedgerEntry,
566
577
  LedgerDataResponse,
567
578
  LedgerDataLedgerState,
579
+ LedgerEntryBinaryRequest,
580
+ LedgerEntryJsonRequest,
568
581
  LedgerEntryRequest,
582
+ LedgerEntryBinaryResponse,
583
+ LedgerEntryJsonResponse,
569
584
  LedgerEntryResponse,
570
585
  // transaction methods with types
571
586
  SimulateRequest,
@@ -144,8 +144,8 @@ export interface LedgerRequestExpandedAccountsOnly extends LedgerRequest {
144
144
  *
145
145
  * @category Requests
146
146
  */
147
- export interface LedgerRequestExpandedAccountsAndTransactions
148
- extends LedgerRequest {
147
+ // eslint-disable-next-line max-len -- Disable for interface declaration.
148
+ export interface LedgerRequestExpandedAccountsAndTransactions extends LedgerRequest {
149
149
  expand: true
150
150
  accounts: true
151
151
  transactions: true
@@ -202,14 +202,18 @@ export interface LedgerQueueData {
202
202
  max_spend_drops?: string
203
203
  }
204
204
 
205
- export interface LedgerBinary
206
- extends Omit<Ledger, 'transactions' | 'accountState'> {
205
+ export interface LedgerBinary extends Omit<
206
+ Ledger,
207
+ 'transactions' | 'accountState'
208
+ > {
207
209
  accountState?: string[]
208
210
  transactions?: string[]
209
211
  }
210
212
 
211
- export interface LedgerBinaryV1
212
- extends Omit<LedgerV1, 'transactions' | 'accountState'> {
213
+ export interface LedgerBinaryV1 extends Omit<
214
+ LedgerV1,
215
+ 'transactions' | 'accountState'
216
+ > {
213
217
  accountState?: string[]
214
218
  transactions?: string[]
215
219
  }
@@ -230,17 +230,60 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest {
230
230
  }
231
231
  }
232
232
 
233
+ export type LedgerEntryBinaryRequest = LedgerEntryRequest & {
234
+ binary: true
235
+ }
236
+
237
+ export type LedgerEntryJsonRequest = LedgerEntryRequest & {
238
+ binary?: false
239
+ }
240
+
241
+ interface LedgerEntryResponseResultBase {
242
+ /** The unique ID of this ledger object. */
243
+ index: string
244
+ /** The ledger index of the ledger that was used when retrieving this data. */
245
+ ledger_current_index: number
246
+ validated?: boolean
247
+ /**
248
+ * (Optional) Indicates the ledger index at which the object was deleted.
249
+ */
250
+ deleted_ledger_index?: number
251
+ }
252
+
253
+ /**
254
+ * Response expected from a {@link LedgerEntryRequest} with binary: true.
255
+ *
256
+ * @category Responses
257
+ */
258
+ export interface LedgerEntryBinaryResponse extends BaseResponse {
259
+ result: LedgerEntryResponseResultBase & {
260
+ /** The binary representation of the ledger object, as hexadecimal. */
261
+ node_binary: string
262
+ }
263
+ }
264
+
265
+ /**
266
+ * Response expected from a {@link LedgerEntryRequest} with binary: false or omitted.
267
+ *
268
+ * @category Responses
269
+ */
270
+ export interface LedgerEntryJsonResponse<T = LedgerEntry> extends BaseResponse {
271
+ result: LedgerEntryResponseResultBase & {
272
+ /**
273
+ * Object containing the data of this ledger object, according to the
274
+ * ledger format.
275
+ */
276
+ node: T
277
+ }
278
+ }
279
+
233
280
  /**
234
281
  * Response expected from a {@link LedgerEntryRequest}.
235
282
  *
236
283
  * @category Responses
237
284
  */
238
285
  export interface LedgerEntryResponse<T = LedgerEntry> extends BaseResponse {
239
- result: {
240
- /** The unique ID of this ledger object. */
241
- index: string
242
- /** The ledger index of the ledger that was used when retrieving this data. */
243
- ledger_current_index: number
286
+ result: LedgerEntryResponseResultBase & {
244
287
  /**
245
288
  * Object containing the data of this ledger object, according to the
246
289
  * ledger format.
@@ -248,10 +291,5 @@ export interface LedgerEntryResponse<T = LedgerEntry> extends BaseResponse {
248
291
  node?: T
249
292
  /** The binary representation of the ledger object, as hexadecimal. */
250
293
  node_binary?: string
251
- validated?: boolean
252
- /**
253
- * (Optional) Indicates the ledger index at which the object was deleted.
254
- */
255
- deleted_ledger_index?: number
256
294
  }
257
295
  }
@@ -9,13 +9,22 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
9
9
  * @category Requests
10
10
  */
11
11
  export interface NFTBuyOffersRequest
12
- extends BaseRequest,
13
- LookupByLedgerRequest {
12
+ extends BaseRequest, LookupByLedgerRequest {
14
13
  command: 'nft_buy_offers'
15
14
  /**
16
15
  * The unique identifier of an NFToken. The request returns buy offers for this NFToken.
17
16
  */
18
17
  nft_id: string
18
+ /**
19
+ * Limit the number of NFT buy offers to retrieve. The server may return
20
+ * fewer results. Valid values are within 50-500. The default is 250.
21
+ */
22
+ limit?: number
23
+ /**
24
+ * Value from a previous paginated response. Resume retrieving data where
25
+ * that response left off.
26
+ */
27
+ marker?: unknown
19
28
  }
20
29
 
21
30
  /**
@@ -33,5 +42,14 @@ export interface NFTBuyOffersResponse extends BaseResponse {
33
42
  * The token ID of the NFToken to which these offers pertain.
34
43
  */
35
44
  nft_id: string
45
+ /**
46
+ * The limit value used in the request.
47
+ */
48
+ limit?: number
49
+ /**
50
+ * Server-defined value indicating the response is paginated. Pass this to
51
+ * the next call to resume where this call left off.
52
+ */
53
+ marker?: unknown
36
54
  }
37
55
  }
@@ -9,13 +9,22 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
9
9
  * @category Requests
10
10
  */
11
11
  export interface NFTSellOffersRequest
12
- extends BaseRequest,
13
- LookupByLedgerRequest {
12
+ extends BaseRequest, LookupByLedgerRequest {
14
13
  command: 'nft_sell_offers'
15
14
  /**
16
15
  * The unique identifier of an NFToken. The request returns sell offers for this NFToken.
17
16
  */
18
17
  nft_id: string
18
+ /**
19
+ * Limit the number of NFT sell offers to retrieve. The server may return
20
+ * fewer results. Valid values are within 50-500. The default is 250.
21
+ */
22
+ limit?: number
23
+ /**
24
+ * Value from a previous paginated response. Resume retrieving data where
25
+ * that response left off.
26
+ */
27
+ marker?: unknown
19
28
  }
20
29
 
21
30
  /**
@@ -33,5 +42,14 @@ export interface NFTSellOffersResponse extends BaseResponse {
33
42
  * The token ID of the NFToken to which these offers pertain.
34
43
  */
35
44
  nft_id: string
45
+ /**
46
+ * The limit value used in the request.
47
+ */
48
+ limit?: number
49
+ /**
50
+ * Server-defined value indicating the response is paginated. Pass this to
51
+ * the next call to resume where this call left off.
52
+ */
53
+ marker?: unknown
36
54
  }
37
55
  }
@@ -11,8 +11,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
11
11
  * @category Requests
12
12
  */
13
13
  export interface NFTsByIssuerRequest
14
- extends BaseRequest,
15
- LookupByLedgerRequest {
14
+ extends BaseRequest, LookupByLedgerRequest {
16
15
  command: 'nfts_by_issuer'
17
16
  /**
18
17
  * A unique identifier for the account, most commonly the account's address
@@ -15,8 +15,7 @@ export interface SourceCurrencyAmount {
15
15
  * @category Requests
16
16
  */
17
17
  export interface RipplePathFindRequest
18
- extends BaseRequest,
19
- LookupByLedgerRequest {
18
+ extends BaseRequest, LookupByLedgerRequest {
20
19
  command: 'ripple_path_find'
21
20
  /** Unique address of the account that would send funds in a transaction. */
22
21
  source_account: string
@@ -45,6 +45,33 @@ export interface ServerDefinitionsResponse extends BaseResponse {
45
45
  TRANSACTION_TYPES: Record<string, number>
46
46
 
47
47
  TYPES: Record<string, number>
48
+
49
+ /** Maps AccountSet flag names (asf flags) to their numeric values. */
50
+ ACCOUNT_SET_FLAGS: Record<string, number>
51
+
52
+ /** Maps ledger entry type names to their flags and flag values. */
53
+ LEDGER_ENTRY_FLAGS: Record<string, Record<string, number>>
54
+
55
+ /**
56
+ * Describes the fields and their optionality for each ledger entry type,
57
+ * including common fields shared across all ledger entries.
58
+ */
59
+ LEDGER_ENTRY_FORMATS: Record<
60
+ string,
61
+ Array<{ name: string; optionality: number }>
62
+ >
63
+
64
+ /** Maps transaction type names to their supported flags and flag values. */
65
+ TRANSACTION_FLAGS: Record<string, Record<string, number>>
66
+
67
+ /**
68
+ * Describes the fields and their optionality for each transaction type,
69
+ * including common fields shared across all transactions.
70
+ */
71
+ TRANSACTION_FORMATS: Record<
72
+ string,
73
+ Array<{ name: string; optionality: number }>
74
+ >
48
75
  }
49
76
  | {
50
77
  FIELDS?: never
@@ -56,6 +83,16 @@ export interface ServerDefinitionsResponse extends BaseResponse {
56
83
  TRANSACTION_TYPES?: never
57
84
 
58
85
  TYPES?: never
86
+
87
+ ACCOUNT_SET_FLAGS?: never
88
+
89
+ LEDGER_ENTRY_FLAGS?: never
90
+
91
+ LEDGER_ENTRY_FORMATS?: never
92
+
93
+ TRANSACTION_FLAGS?: never
94
+
95
+ TRANSACTION_FORMATS?: never
59
96
  }
60
97
  )
61
98
  }
@@ -64,8 +64,9 @@ export interface SimulateBinaryResponse extends BaseResponse {
64
64
  }
65
65
  }
66
66
 
67
- export interface SimulateJsonResponse<T extends BaseTransaction = Transaction>
68
- extends BaseResponse {
67
+ export interface SimulateJsonResponse<
68
+ T extends BaseTransaction = Transaction,
69
+ > extends BaseResponse {
69
70
  result: {
70
71
  applied: false
71
72
 
@@ -11,8 +11,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
11
11
  * @category Requests
12
12
  */
13
13
  export interface TransactionEntryRequest
14
- extends BaseRequest,
15
- LookupByLedgerRequest {
14
+ extends BaseRequest, LookupByLedgerRequest {
16
15
  command: 'transaction_entry'
17
16
 
18
17
  /** Unique hash of the transaction you are looking up. */
@@ -93,8 +93,9 @@ interface BaseTxResult<
93
93
  *
94
94
  * @category Responses
95
95
  */
96
- export interface TxResponse<T extends BaseTransaction = Transaction>
97
- extends BaseResponse {
96
+ export interface TxResponse<
97
+ T extends BaseTransaction = Transaction,
98
+ > extends BaseResponse {
98
99
  result: BaseTxResult<typeof RIPPLED_API_V2, T> & { tx_json: T }
99
100
  /**
100
101
  * If true, the server was able to search all of the specified ledger
@@ -110,8 +111,9 @@ export interface TxResponse<T extends BaseTransaction = Transaction>
110
111
  *
111
112
  * @category ResponsesV1
112
113
  */
113
- export interface TxV1Response<T extends BaseTransaction = Transaction>
114
- extends BaseResponse {
114
+ export interface TxV1Response<
115
+ T extends BaseTransaction = Transaction,
116
+ > extends BaseResponse {
115
117
  result: BaseTxResult<typeof RIPPLED_API_V1, T> & T
116
118
  /**
117
119
  * If true, the server was able to search all of the specified ledger
@@ -199,6 +199,12 @@ export interface VaultInfoResponse extends BaseResponse {
199
199
  */
200
200
  ledger_index?: number
201
201
 
202
+ /**
203
+ * The ledger index of the current in-progress ledger, which was used when
204
+ * retrieving this information. May be omitted.
205
+ */
206
+ ledger_current_index?: number
207
+
202
208
  /**
203
209
  * If included and set to true, the information in this response comes from
204
210
  * a validated ledger version. Otherwise, the information is subject to
@@ -63,8 +63,8 @@ export enum MPTokenIssuanceCreateFlags {
63
63
  *
64
64
  * @category Transaction Flags
65
65
  */
66
- export interface MPTokenIssuanceCreateFlagsInterface
67
- extends GlobalFlagsInterface {
66
+ // eslint-disable-next-line max-len -- Disable for interface declaration.
67
+ export interface MPTokenIssuanceCreateFlagsInterface extends GlobalFlagsInterface {
68
68
  tfMPTCanLock?: boolean
69
69
  tfMPTRequireAuth?: boolean
70
70
  tfMPTCanEscrow?: boolean
@@ -73,8 +73,8 @@ export enum PaymentChannelClaimFlags {
73
73
  * // }
74
74
  * ```
75
75
  */
76
- export interface PaymentChannelClaimFlagsInterface
77
- extends GlobalFlagsInterface {
76
+ // eslint-disable-next-line max-len -- Disable for interface declaration.
77
+ export interface PaymentChannelClaimFlagsInterface extends GlobalFlagsInterface {
78
78
  /**
79
79
  * Clear the channel's Expiration time. (Expiration is different from the
80
80
  * channel's immutable CancelAfter time.) Only the source address of the
@@ -17,7 +17,11 @@ function percentToDecimal(percent: string): string {
17
17
  throw new ValidationError(`Value ${percent} contains too many % signs`)
18
18
  }
19
19
 
20
- return new BigNumber(split[0]).dividedBy('100').toString(BASE_TEN)
20
+ try {
21
+ return new BigNumber(split[0]).dividedBy('100').toString(BASE_TEN)
22
+ } catch (_err) {
23
+ throw new ValidationError(`Value is not a number`)
24
+ }
21
25
  }
22
26
 
23
27
  /**
@@ -30,7 +34,12 @@ function percentToDecimal(percent: string): string {
30
34
  * @category Utilities
31
35
  */
32
36
  export function decimalToTransferRate(decimal: string): number {
33
- const rate = new BigNumber(decimal).times(ONE_BILLION).plus(ONE_BILLION)
37
+ let rate: BigNumber
38
+ try {
39
+ rate = new BigNumber(decimal).times(ONE_BILLION).plus(ONE_BILLION)
40
+ } catch (_err) {
41
+ throw new ValidationError(`Value is not a number`)
42
+ }
34
43
 
35
44
  if (rate.isLessThan(ONE_BILLION) || rate.isGreaterThan(TWO_BILLION)) {
36
45
  throw new ValidationError(`Decimal value must be between 0 and 1.00.`)
@@ -42,10 +51,6 @@ export function decimalToTransferRate(decimal: string): number {
42
51
  return 0
43
52
  }
44
53
 
45
- if (billionths === 'NaN') {
46
- throw new ValidationError(`Value is not a number`)
47
- }
48
-
49
54
  if (billionths.includes('.')) {
50
55
  throw new ValidationError(`Decimal exceeds maximum precision.`)
51
56
  }
@@ -77,14 +82,15 @@ export function percentToTransferRate(percent: string): number {
77
82
  * @category Utilities
78
83
  */
79
84
  export function decimalToQuality(decimal: string): number {
80
- const rate = new BigNumber(decimal).times(ONE_BILLION)
81
-
82
- const billionths = rate.toString(BASE_TEN)
83
-
84
- if (billionths === 'NaN') {
85
+ let rate: BigNumber
86
+ try {
87
+ rate = new BigNumber(decimal).times(ONE_BILLION)
88
+ } catch (_err) {
85
89
  throw new ValidationError(`Value is not a number`)
86
90
  }
87
91
 
92
+ const billionths = rate.toString(BASE_TEN)
93
+
88
94
  if (billionths.includes('-')) {
89
95
  throw new ValidationError('Cannot have negative Quality')
90
96
  }
@@ -21,12 +21,12 @@ export function dropsToXrp(dropsToConvert: BigNumber.Value): number {
21
21
  * decimal point followed by zeros, e.g. '1.00'.
22
22
  * Important: specify base BASE_10 to avoid exponential notation, e.g. '1e-7'.
23
23
  */
24
- const drops = new BigNumber(dropsToConvert).toString(BASE_TEN)
25
-
26
- // check that the value is valid and actually a number
27
- if (typeof dropsToConvert === 'string' && drops === 'NaN') {
24
+ let drops: string
25
+ try {
26
+ drops = new BigNumber(dropsToConvert).toString(BASE_TEN)
27
+ } catch (_err) {
28
28
  throw new ValidationError(
29
- `dropsToXrp: invalid value '${dropsToConvert}', should be a BigNumber or string-encoded number.`,
29
+ `dropsToXrp: invalid value '${typeof dropsToConvert === 'string' ? dropsToConvert : JSON.stringify(dropsToConvert)}', should be a BigNumber or string-encoded number.`,
30
30
  )
31
31
  }
32
32
 
@@ -63,12 +63,12 @@ export function dropsToXrp(dropsToConvert: BigNumber.Value): number {
63
63
  */
64
64
  export function xrpToDrops(xrpToConvert: BigNumber.Value): string {
65
65
  // Important: specify base BASE_TEN to avoid exponential notation, e.g. '1e-7'.
66
- const xrp = new BigNumber(xrpToConvert).toString(BASE_TEN)
67
-
68
- // check that the value is valid and actually a number
69
- if (typeof xrpToConvert === 'string' && xrp === 'NaN') {
66
+ let xrp: string
67
+ try {
68
+ xrp = new BigNumber(xrpToConvert).toString(BASE_TEN)
69
+ } catch (_err) {
70
70
  throw new ValidationError(
71
- `xrpToDrops: invalid value '${xrpToConvert}', should be a BigNumber or string-encoded number.`,
71
+ `xrpToDrops: invalid value '${typeof xrpToConvert === 'string' ? xrpToConvert : JSON.stringify(xrpToConvert)}', should be a BigNumber or string-encoded number.`,
72
72
  )
73
73
  }
74
74