xrpl 4.0.1-mpt-beta → 4.1.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 (258) hide show
  1. package/README.md +1 -1
  2. package/build/xrpl-latest.js +2510 -793
  3. package/build/xrpl-latest.js.map +1 -1
  4. package/dist/npm/client/partialPayment.d.ts +2 -2
  5. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  6. package/dist/npm/client/partialPayment.js +4 -5
  7. package/dist/npm/client/partialPayment.js.map +1 -1
  8. package/dist/npm/models/common/index.d.ts +6 -0
  9. package/dist/npm/models/common/index.d.ts.map +1 -1
  10. package/dist/npm/models/ledger/Credential.d.ts +17 -0
  11. package/dist/npm/models/ledger/Credential.d.ts.map +1 -0
  12. package/dist/npm/models/ledger/Credential.js +3 -0
  13. package/dist/npm/models/ledger/Credential.js.map +1 -0
  14. package/dist/npm/models/ledger/DepositPreauth.d.ts +3 -1
  15. package/dist/npm/models/ledger/DepositPreauth.d.ts.map +1 -1
  16. package/dist/npm/models/ledger/Ledger.d.ts +1 -0
  17. package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
  18. package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
  19. package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
  20. package/dist/npm/models/ledger/MPToken.d.ts +1 -2
  21. package/dist/npm/models/ledger/MPToken.d.ts.map +1 -1
  22. package/dist/npm/models/ledger/MPTokenIssuance.d.ts +0 -1
  23. package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -1
  24. package/dist/npm/models/ledger/index.d.ts +4 -3
  25. package/dist/npm/models/ledger/index.d.ts.map +1 -1
  26. package/dist/npm/models/ledger/index.js.map +1 -1
  27. package/dist/npm/models/methods/depositAuthorized.d.ts +2 -0
  28. package/dist/npm/models/methods/depositAuthorized.d.ts.map +1 -1
  29. package/dist/npm/models/methods/index.d.ts +2 -2
  30. package/dist/npm/models/methods/index.d.ts.map +1 -1
  31. package/dist/npm/models/methods/ledgerEntry.d.ts +7 -0
  32. package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
  33. package/dist/npm/models/methods/subscribe.d.ts +7 -3
  34. package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
  35. package/dist/npm/models/transactions/CredentialAccept.d.ts +9 -0
  36. package/dist/npm/models/transactions/CredentialAccept.d.ts.map +1 -0
  37. package/dist/npm/models/transactions/CredentialAccept.js +12 -0
  38. package/dist/npm/models/transactions/CredentialAccept.js.map +1 -0
  39. package/dist/npm/models/transactions/CredentialCreate.d.ts +11 -0
  40. package/dist/npm/models/transactions/CredentialCreate.d.ts.map +1 -0
  41. package/dist/npm/models/transactions/CredentialCreate.js +34 -0
  42. package/dist/npm/models/transactions/CredentialCreate.js.map +1 -0
  43. package/dist/npm/models/transactions/CredentialDelete.d.ts +10 -0
  44. package/dist/npm/models/transactions/CredentialDelete.d.ts.map +1 -0
  45. package/dist/npm/models/transactions/CredentialDelete.js +17 -0
  46. package/dist/npm/models/transactions/CredentialDelete.js.map +1 -0
  47. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts +1 -1
  48. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
  49. package/dist/npm/models/transactions/MPTokenAuthorize.js +1 -1
  50. package/dist/npm/models/transactions/MPTokenAuthorize.js.map +1 -1
  51. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  52. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +28 -0
  53. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  54. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +1 -1
  55. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
  56. package/dist/npm/models/transactions/MPTokenIssuanceSet.js +11 -4
  57. package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
  58. package/dist/npm/models/transactions/accountDelete.d.ts +1 -0
  59. package/dist/npm/models/transactions/accountDelete.d.ts.map +1 -1
  60. package/dist/npm/models/transactions/accountDelete.js +1 -0
  61. package/dist/npm/models/transactions/accountDelete.js.map +1 -1
  62. package/dist/npm/models/transactions/clawback.d.ts +1 -1
  63. package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
  64. package/dist/npm/models/transactions/clawback.js +6 -6
  65. package/dist/npm/models/transactions/clawback.js.map +1 -1
  66. package/dist/npm/models/transactions/common.d.ts +2 -0
  67. package/dist/npm/models/transactions/common.d.ts.map +1 -1
  68. package/dist/npm/models/transactions/common.js +68 -3
  69. package/dist/npm/models/transactions/common.js.map +1 -1
  70. package/dist/npm/models/transactions/depositPreauth.d.ts +3 -0
  71. package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
  72. package/dist/npm/models/transactions/depositPreauth.js +20 -7
  73. package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
  74. package/dist/npm/models/transactions/escrowFinish.d.ts +1 -0
  75. package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
  76. package/dist/npm/models/transactions/escrowFinish.js +1 -0
  77. package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
  78. package/dist/npm/models/transactions/index.d.ts +3 -0
  79. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  80. package/dist/npm/models/transactions/index.js.map +1 -1
  81. package/dist/npm/models/transactions/metadata.d.ts +1 -1
  82. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  83. package/dist/npm/models/transactions/payment.d.ts +3 -2
  84. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  85. package/dist/npm/models/transactions/payment.js +1 -0
  86. package/dist/npm/models/transactions/payment.js.map +1 -1
  87. package/dist/npm/models/transactions/paymentChannelClaim.d.ts +1 -0
  88. package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
  89. package/dist/npm/models/transactions/paymentChannelClaim.js +1 -0
  90. package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
  91. package/dist/npm/models/transactions/transaction.d.ts +8 -5
  92. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  93. package/dist/npm/models/transactions/transaction.js +16 -4
  94. package/dist/npm/models/transactions/transaction.js.map +1 -1
  95. package/dist/npm/models/utils/flags.d.ts.map +1 -1
  96. package/dist/npm/models/utils/flags.js +3 -3
  97. package/dist/npm/models/utils/flags.js.map +1 -1
  98. package/dist/npm/models/utils/index.d.ts +1 -0
  99. package/dist/npm/models/utils/index.d.ts.map +1 -1
  100. package/dist/npm/models/utils/index.js +2 -1
  101. package/dist/npm/models/utils/index.js.map +1 -1
  102. package/dist/npm/snippets/src/paths.js +5 -9
  103. package/dist/npm/snippets/src/paths.js.map +1 -1
  104. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  105. package/dist/npm/src/client/partialPayment.d.ts +2 -2
  106. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  107. package/dist/npm/src/client/partialPayment.js +4 -5
  108. package/dist/npm/src/client/partialPayment.js.map +1 -1
  109. package/dist/npm/src/models/common/index.d.ts +6 -0
  110. package/dist/npm/src/models/common/index.d.ts.map +1 -1
  111. package/dist/npm/src/models/ledger/Credential.d.ts +17 -0
  112. package/dist/npm/src/models/ledger/Credential.d.ts.map +1 -0
  113. package/dist/npm/src/models/ledger/Credential.js +3 -0
  114. package/dist/npm/src/models/ledger/Credential.js.map +1 -0
  115. package/dist/npm/src/models/ledger/DepositPreauth.d.ts +3 -1
  116. package/dist/npm/src/models/ledger/DepositPreauth.d.ts.map +1 -1
  117. package/dist/npm/src/models/ledger/Ledger.d.ts +1 -0
  118. package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
  119. package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
  120. package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
  121. package/dist/npm/src/models/ledger/MPToken.d.ts +1 -2
  122. package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -1
  123. package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +0 -1
  124. package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -1
  125. package/dist/npm/src/models/ledger/index.d.ts +4 -3
  126. package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
  127. package/dist/npm/src/models/ledger/index.js.map +1 -1
  128. package/dist/npm/src/models/methods/depositAuthorized.d.ts +2 -0
  129. package/dist/npm/src/models/methods/depositAuthorized.d.ts.map +1 -1
  130. package/dist/npm/src/models/methods/index.d.ts +2 -2
  131. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  132. package/dist/npm/src/models/methods/ledgerEntry.d.ts +7 -0
  133. package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
  134. package/dist/npm/src/models/methods/subscribe.d.ts +7 -3
  135. package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
  136. package/dist/npm/src/models/transactions/CredentialAccept.d.ts +9 -0
  137. package/dist/npm/src/models/transactions/CredentialAccept.d.ts.map +1 -0
  138. package/dist/npm/src/models/transactions/CredentialAccept.js +12 -0
  139. package/dist/npm/src/models/transactions/CredentialAccept.js.map +1 -0
  140. package/dist/npm/src/models/transactions/CredentialCreate.d.ts +11 -0
  141. package/dist/npm/src/models/transactions/CredentialCreate.d.ts.map +1 -0
  142. package/dist/npm/src/models/transactions/CredentialCreate.js +34 -0
  143. package/dist/npm/src/models/transactions/CredentialCreate.js.map +1 -0
  144. package/dist/npm/src/models/transactions/CredentialDelete.d.ts +10 -0
  145. package/dist/npm/src/models/transactions/CredentialDelete.d.ts.map +1 -0
  146. package/dist/npm/src/models/transactions/CredentialDelete.js +17 -0
  147. package/dist/npm/src/models/transactions/CredentialDelete.js.map +1 -0
  148. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts +1 -1
  149. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
  150. package/dist/npm/src/models/transactions/MPTokenAuthorize.js +1 -1
  151. package/dist/npm/src/models/transactions/MPTokenAuthorize.js.map +1 -1
  152. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  153. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +28 -0
  154. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  155. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +1 -1
  156. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
  157. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +11 -4
  158. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -1
  159. package/dist/npm/src/models/transactions/accountDelete.d.ts +1 -0
  160. package/dist/npm/src/models/transactions/accountDelete.d.ts.map +1 -1
  161. package/dist/npm/src/models/transactions/accountDelete.js +1 -0
  162. package/dist/npm/src/models/transactions/accountDelete.js.map +1 -1
  163. package/dist/npm/src/models/transactions/clawback.d.ts +1 -1
  164. package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
  165. package/dist/npm/src/models/transactions/clawback.js +6 -6
  166. package/dist/npm/src/models/transactions/clawback.js.map +1 -1
  167. package/dist/npm/src/models/transactions/common.d.ts +2 -0
  168. package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
  169. package/dist/npm/src/models/transactions/common.js +68 -3
  170. package/dist/npm/src/models/transactions/common.js.map +1 -1
  171. package/dist/npm/src/models/transactions/depositPreauth.d.ts +3 -0
  172. package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
  173. package/dist/npm/src/models/transactions/depositPreauth.js +20 -7
  174. package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
  175. package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -0
  176. package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
  177. package/dist/npm/src/models/transactions/escrowFinish.js +1 -0
  178. package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
  179. package/dist/npm/src/models/transactions/index.d.ts +3 -0
  180. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  181. package/dist/npm/src/models/transactions/index.js.map +1 -1
  182. package/dist/npm/src/models/transactions/metadata.d.ts +1 -1
  183. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  184. package/dist/npm/src/models/transactions/payment.d.ts +3 -2
  185. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  186. package/dist/npm/src/models/transactions/payment.js +1 -0
  187. package/dist/npm/src/models/transactions/payment.js.map +1 -1
  188. package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts +1 -0
  189. package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
  190. package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -0
  191. package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
  192. package/dist/npm/src/models/transactions/transaction.d.ts +8 -5
  193. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  194. package/dist/npm/src/models/transactions/transaction.js +16 -4
  195. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  196. package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
  197. package/dist/npm/src/models/utils/flags.js +3 -3
  198. package/dist/npm/src/models/utils/flags.js.map +1 -1
  199. package/dist/npm/src/models/utils/index.d.ts +1 -0
  200. package/dist/npm/src/models/utils/index.d.ts.map +1 -1
  201. package/dist/npm/src/models/utils/index.js +2 -1
  202. package/dist/npm/src/models/utils/index.js.map +1 -1
  203. package/dist/npm/src/utils/index.d.ts +1 -2
  204. package/dist/npm/src/utils/index.d.ts.map +1 -1
  205. package/dist/npm/src/utils/index.js +1 -3
  206. package/dist/npm/src/utils/index.js.map +1 -1
  207. package/dist/npm/utils/index.d.ts +1 -2
  208. package/dist/npm/utils/index.d.ts.map +1 -1
  209. package/dist/npm/utils/index.js +1 -3
  210. package/dist/npm/utils/index.js.map +1 -1
  211. package/package.json +5 -5
  212. package/src/client/partialPayment.ts +18 -5
  213. package/src/models/common/index.ts +10 -0
  214. package/src/models/ledger/Credential.ts +47 -0
  215. package/src/models/ledger/DepositPreauth.ts +6 -2
  216. package/src/models/ledger/Ledger.ts +5 -0
  217. package/src/models/ledger/LedgerEntry.ts +3 -0
  218. package/src/models/ledger/MPToken.ts +1 -2
  219. package/src/models/ledger/MPTokenIssuance.ts +0 -1
  220. package/src/models/ledger/index.ts +4 -2
  221. package/src/models/methods/depositAuthorized.ts +10 -0
  222. package/src/models/methods/index.ts +2 -0
  223. package/src/models/methods/ledgerEntry.ts +29 -1
  224. package/src/models/methods/subscribe.ts +34 -3
  225. package/src/models/transactions/CredentialAccept.ts +44 -0
  226. package/src/models/transactions/CredentialCreate.ts +81 -0
  227. package/src/models/transactions/CredentialDelete.ts +55 -0
  228. package/src/models/transactions/MPTokenAuthorize.ts +2 -2
  229. package/src/models/transactions/MPTokenIssuanceCreate.ts +58 -11
  230. package/src/models/transactions/MPTokenIssuanceSet.ts +18 -8
  231. package/src/models/transactions/accountDelete.ts +14 -0
  232. package/src/models/transactions/clawback.ts +7 -9
  233. package/src/models/transactions/common.ts +117 -0
  234. package/src/models/transactions/depositPreauth.ts +51 -15
  235. package/src/models/transactions/escrowFinish.ts +12 -0
  236. package/src/models/transactions/index.ts +3 -0
  237. package/src/models/transactions/metadata.ts +4 -4
  238. package/src/models/transactions/payment.ts +15 -2
  239. package/src/models/transactions/paymentChannelClaim.ts +18 -1
  240. package/src/models/transactions/transaction.ts +31 -13
  241. package/src/models/utils/flags.ts +3 -3
  242. package/src/models/utils/index.ts +1 -0
  243. package/src/utils/index.ts +0 -2
  244. package/build/xrpl-latest-min.js +0 -3
  245. package/build/xrpl-latest-min.js.map +0 -1
  246. package/dist/npm/snippets/src/bridgeTransfer.d.ts +0 -2
  247. package/dist/npm/snippets/src/bridgeTransfer.d.ts.map +0 -1
  248. package/dist/npm/snippets/src/bridgeTransfer.js +0 -126
  249. package/dist/npm/snippets/src/bridgeTransfer.js.map +0 -1
  250. package/dist/npm/src/utils/mptConversion.d.ts +0 -2
  251. package/dist/npm/src/utils/mptConversion.d.ts.map +0 -1
  252. package/dist/npm/src/utils/mptConversion.js +0 -31
  253. package/dist/npm/src/utils/mptConversion.js.map +0 -1
  254. package/dist/npm/utils/mptConversion.d.ts +0 -2
  255. package/dist/npm/utils/mptConversion.d.ts.map +0 -1
  256. package/dist/npm/utils/mptConversion.js +0 -31
  257. package/dist/npm/utils/mptConversion.js.map +0 -1
  258. package/src/utils/mptConversion.ts +0 -61
@@ -31,6 +31,11 @@ interface BaseLedger {
31
31
  * by which the close_time could be rounded.
32
32
  */
33
33
  close_time_resolution: number
34
+ /**
35
+ * The approximate time this ledger was closed, in date time string format.
36
+ * Always uses the UTC time zone.
37
+ */
38
+ close_time_iso: string
34
39
  /** Whether or not this ledger has been closed. */
35
40
  closed: boolean
36
41
  /**
@@ -3,6 +3,7 @@ import Amendments from './Amendments'
3
3
  import AMM from './AMM'
4
4
  import Bridge from './Bridge'
5
5
  import Check from './Check'
6
+ import Credential from './Credential'
6
7
  import DepositPreauth from './DepositPreauth'
7
8
  import DirectoryNode from './DirectoryNode'
8
9
  import Escrow from './Escrow'
@@ -24,6 +25,7 @@ type LedgerEntry =
24
25
  | AMM
25
26
  | Bridge
26
27
  | Check
28
+ | Credential
27
29
  | DepositPreauth
28
30
  | DirectoryNode
29
31
  | Escrow
@@ -45,6 +47,7 @@ type LedgerEntryFilter =
45
47
  | 'amm'
46
48
  | 'bridge'
47
49
  | 'check'
50
+ | 'credential'
48
51
  | 'deposit_preauth'
49
52
  | 'did'
50
53
  | 'directory'
@@ -5,8 +5,7 @@ import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
5
5
  export interface MPToken extends BaseLedgerEntry, HasPreviousTxnID {
6
6
  LedgerEntryType: 'MPToken'
7
7
  MPTokenIssuanceID: string
8
- MPTAmount: MPTAmount
9
- LockedAmount?: MPTAmount
8
+ MPTAmount?: MPTAmount
10
9
  Flags: number
11
10
  OwnerNode?: string
12
11
  }
@@ -7,7 +7,6 @@ export interface MPTokenIssuance extends BaseLedgerEntry, HasPreviousTxnID {
7
7
  AssetScale?: number
8
8
  MaximumAmount?: string
9
9
  OutstandingAmount: string
10
- LockedAmount?: string
11
10
  TransferFee?: number
12
11
  MPTokenMetadata?: string
13
12
  OwnerNode?: string
@@ -6,6 +6,7 @@ import Amendments, { Majority, AMENDMENTS_ID } from './Amendments'
6
6
  import AMM, { VoteSlot } from './AMM'
7
7
  import Bridge from './Bridge'
8
8
  import Check from './Check'
9
+ import Credential from './Credential'
9
10
  import DepositPreauth from './DepositPreauth'
10
11
  import DID from './DID'
11
12
  import DirectoryNode from './DirectoryNode'
@@ -18,9 +19,9 @@ import FeeSettings, {
18
19
  import { Ledger, LedgerV1 } from './Ledger'
19
20
  import { LedgerEntry, LedgerEntryFilter } from './LedgerEntry'
20
21
  import LedgerHashes from './LedgerHashes'
21
- import NegativeUNL, { NEGATIVE_UNL_ID } from './NegativeUNL'
22
- import { MPTokenIssuance } from './MPTokenIssuance'
23
22
  import { MPToken } from './MPToken'
23
+ import { MPTokenIssuance } from './MPTokenIssuance'
24
+ import NegativeUNL, { NEGATIVE_UNL_ID } from './NegativeUNL'
24
25
  import { NFTokenOffer } from './NFTokenOffer'
25
26
  import { NFToken, NFTokenPage } from './NFTokenPage'
26
27
  import Offer, { OfferFlags } from './Offer'
@@ -41,6 +42,7 @@ export {
41
42
  AMM,
42
43
  Bridge,
43
44
  Check,
45
+ Credential,
44
46
  DepositPreauth,
45
47
  DirectoryNode,
46
48
  DID,
@@ -15,6 +15,12 @@ export interface DepositAuthorizedRequest
15
15
  source_account: string
16
16
  /** The recipient of a possible payment. */
17
17
  destination_account: string
18
+ /**
19
+ * The object IDs of Credential objects. If this field is included, then the
20
+ * credential will be taken into account when analyzing whether the sender can send
21
+ * funds to the destination.
22
+ */
23
+ credentials?: string[]
18
24
  }
19
25
 
20
26
  /**
@@ -52,5 +58,9 @@ export interface DepositAuthorizedResponse extends BaseResponse {
52
58
  source_account: string
53
59
  /** If true, the information comes from a validated ledger version. */
54
60
  validated?: boolean
61
+ /** The object IDs of `Credential` objects. If this field is included,
62
+ * then the credential will be taken into account when analyzing whether
63
+ * the sender can send funds to the destination. */
64
+ credentials?: string[]
55
65
  }
56
66
  }
@@ -168,6 +168,7 @@ import {
168
168
  SubscribeRequest,
169
169
  SubscribeResponse,
170
170
  TransactionStream,
171
+ TransactionV1Stream,
171
172
  ValidationStream,
172
173
  } from './subscribe'
173
174
  import {
@@ -583,6 +584,7 @@ export {
583
584
  LedgerStreamResponse,
584
585
  ValidationStream,
585
586
  TransactionStream,
587
+ TransactionV1Stream,
586
588
  PathFindStream,
587
589
  PeerStatusStream,
588
590
  OrderBookStream,
@@ -51,7 +51,14 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest {
51
51
  issuer?: string
52
52
  }
53
53
  }
54
-
54
+ /**
55
+ * (Optional) If set to true and the queried object has been deleted,
56
+ * return its complete data prior to its deletion.
57
+ * If set to false or not provided and the queried object has been deleted,
58
+ * return objectNotFound (current behavior).
59
+ * This parameter is supported only by Clio servers
60
+ */
61
+ include_deleted?: boolean
55
62
  /**
56
63
  * If true, return the requested ledger object's contents as a hex string in
57
64
  * the XRP Ledger's binary format. Otherwise, return data in JSON format. The
@@ -76,6 +83,23 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest {
76
83
  /** The object ID of a Check object to retrieve. */
77
84
  check?: string
78
85
 
86
+ /* Specify the Credential to retrieve. If a string, must be the ledger entry ID of
87
+ * the entry, as hexadecimal. If an object, requires subject, issuer, and
88
+ * credential_type sub-fields.
89
+ */
90
+ credential?:
91
+ | {
92
+ /** The account that is the subject of the credential. */
93
+ subject: string
94
+
95
+ /** The account that issued the credential. */
96
+ issuer: string
97
+
98
+ /** The type of the credential, as issued. */
99
+ credentialType: string
100
+ }
101
+ | string
102
+
79
103
  /**
80
104
  * Specify a DepositPreauth object to retrieve. If a string, must be the
81
105
  * object ID of the DepositPreauth object, as hexadecimal. If an object,
@@ -220,5 +244,9 @@ export interface LedgerEntryResponse<T = LedgerEntry> extends BaseResponse {
220
244
  /** The binary representation of the ledger object, as hexadecimal. */
221
245
  node_binary?: string
222
246
  validated?: boolean
247
+ /**
248
+ * (Optional) Indicates the ledger index at which the object was deleted.
249
+ */
250
+ deleted_ledger_index?: number
223
251
  }
224
252
  }
@@ -4,6 +4,10 @@ import type {
4
4
  Path,
5
5
  StreamType,
6
6
  ResponseOnlyTxInfo,
7
+ APIVersion,
8
+ DEFAULT_API_VERSION,
9
+ RIPPLED_API_V1,
10
+ RIPPLED_API_V2,
7
11
  } from '../common'
8
12
  import { Offer } from '../ledger'
9
13
  import { OfferCreate, Transaction } from '../transactions'
@@ -262,9 +266,16 @@ export interface ValidationStream extends BaseStream {
262
266
  *
263
267
  * @category Streams
264
268
  */
265
- export interface TransactionStream extends BaseStream {
269
+ interface TransactionStreamBase<
270
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
271
+ > extends BaseStream {
266
272
  status: string
267
273
  type: 'transaction'
274
+ /**
275
+ * The approximate time this ledger was closed, in date time string format.
276
+ * Always uses the UTC time zone.
277
+ */
278
+ close_time_iso: string
268
279
  /** String Transaction result code. */
269
280
  engine_result: string
270
281
  /** Numeric transaction response code, if applicable. */
@@ -285,8 +296,14 @@ export interface TransactionStream extends BaseStream {
285
296
  * in detail.
286
297
  */
287
298
  meta?: TransactionMetadata
288
- /** The definition of the transaction in JSON format. */
289
- transaction: Transaction & ResponseOnlyTxInfo
299
+ /** JSON object defining the transaction. */
300
+ tx_json?: Version extends typeof RIPPLED_API_V2
301
+ ? Transaction & ResponseOnlyTxInfo
302
+ : never
303
+ /** JSON object defining the transaction in rippled API v1. */
304
+ transaction?: Version extends typeof RIPPLED_API_V1
305
+ ? Transaction & ResponseOnlyTxInfo
306
+ : never
290
307
  /**
291
308
  * If true, this transaction is included in a validated ledger and its
292
309
  * outcome is final. Responses from the transaction stream should always be
@@ -296,6 +313,20 @@ export interface TransactionStream extends BaseStream {
296
313
  warnings?: Array<{ id: number; message: string }>
297
314
  }
298
315
 
316
+ /**
317
+ * Expected response from an {@link AccountTxRequest}.
318
+ *
319
+ * @category Streams
320
+ */
321
+ export type TransactionStream = TransactionStreamBase
322
+
323
+ /**
324
+ * Expected response from an {@link AccountTxRequest} with `api_version` set to 1.
325
+ *
326
+ * @category Streams
327
+ */
328
+ export type TransactionV1Stream = TransactionStreamBase<typeof RIPPLED_API_V1>
329
+
299
330
  /**
300
331
  * The admin-only `peer_status` stream reports a large amount of information on
301
332
  * the activities of other rippled servers to which this server is connected, in
@@ -0,0 +1,44 @@
1
+ import {
2
+ BaseTransaction,
3
+ isString,
4
+ validateBaseTransaction,
5
+ validateCredentialType,
6
+ validateRequiredField,
7
+ } from './common'
8
+
9
+ /**
10
+ * Accepts a credential issued to the Account (i.e. the Account is the Subject of the Credential object).
11
+ * Credentials are represented in hex. Whilst they are allowed a maximum length of 64
12
+ * bytes, every byte requires 2 hex characters for representation.
13
+ * The credential is not considered valid until it has been transferred/accepted.
14
+ *
15
+ * @category Transaction Models
16
+ * */
17
+ export interface CredentialAccept extends BaseTransaction {
18
+ TransactionType: 'CredentialAccept'
19
+
20
+ /** The subject of the credential. */
21
+ Account: string
22
+
23
+ /** The issuer of the credential. */
24
+ Issuer: string
25
+
26
+ /** A hex-encoded value to identify the type of credential from the issuer. */
27
+ CredentialType: string
28
+ }
29
+
30
+ /**
31
+ * Verify the form and type of a CredentialAccept at runtime.
32
+ *
33
+ * @param tx - A CredentialAccept Transaction.
34
+ * @throws When the CredentialAccept is Malformed.
35
+ */
36
+ export function validateCredentialAccept(tx: Record<string, unknown>): void {
37
+ validateBaseTransaction(tx)
38
+
39
+ validateRequiredField(tx, 'Account', isString)
40
+
41
+ validateRequiredField(tx, 'Issuer', isString)
42
+
43
+ validateCredentialType(tx)
44
+ }
@@ -0,0 +1,81 @@
1
+ import { HEX_REGEX } from '@xrplf/isomorphic/utils'
2
+
3
+ import { ValidationError } from '../../errors'
4
+
5
+ import {
6
+ BaseTransaction,
7
+ isNumber,
8
+ isString,
9
+ validateBaseTransaction,
10
+ validateCredentialType,
11
+ validateOptionalField,
12
+ validateRequiredField,
13
+ } from './common'
14
+
15
+ const MAX_URI_LENGTH = 256
16
+
17
+ /**
18
+ * Creates a Credential object. It must be sent by the issuer.
19
+ *
20
+ * @category Transaction Models
21
+ * */
22
+ export interface CredentialCreate extends BaseTransaction {
23
+ TransactionType: 'CredentialCreate'
24
+
25
+ /** The issuer of the credential. */
26
+ Account: string
27
+
28
+ /** The subject of the credential. */
29
+ Subject: string
30
+
31
+ /** A hex-encoded value to identify the type of credential from the issuer. */
32
+ CredentialType: string
33
+
34
+ /** Credential expiration. */
35
+ Expiration?: number
36
+
37
+ /** Additional data about the credential (such as a link to the VC document). */
38
+ URI?: string
39
+ }
40
+
41
+ /**
42
+ * Verify the form and type of a CredentialCreate at runtime.
43
+ *
44
+ * @param tx - A CredentialCreate Transaction.
45
+ * @throws When the CredentialCreate is Malformed.
46
+ */
47
+ export function validateCredentialCreate(tx: Record<string, unknown>): void {
48
+ validateBaseTransaction(tx)
49
+
50
+ validateRequiredField(tx, 'Account', isString)
51
+
52
+ validateRequiredField(tx, 'Subject', isString)
53
+
54
+ validateCredentialType(tx)
55
+
56
+ validateOptionalField(tx, 'Expiration', isNumber)
57
+
58
+ validateURI(tx.URI)
59
+ }
60
+
61
+ function validateURI(URI: unknown): void {
62
+ if (URI === undefined) {
63
+ return
64
+ }
65
+
66
+ if (typeof URI !== 'string') {
67
+ throw new ValidationError('CredentialCreate: invalid field URI')
68
+ }
69
+
70
+ if (URI.length === 0) {
71
+ throw new ValidationError('CredentialCreate: URI cannot be an empty string')
72
+ } else if (URI.length > MAX_URI_LENGTH) {
73
+ throw new ValidationError(
74
+ `CredentialCreate: URI length must be <= ${MAX_URI_LENGTH}`,
75
+ )
76
+ }
77
+
78
+ if (!HEX_REGEX.test(URI)) {
79
+ throw new ValidationError('CredentialCreate: URI must be encoded in hex')
80
+ }
81
+ }
@@ -0,0 +1,55 @@
1
+ import { ValidationError } from '../../errors'
2
+
3
+ import {
4
+ BaseTransaction,
5
+ isString,
6
+ validateBaseTransaction,
7
+ validateCredentialType,
8
+ validateOptionalField,
9
+ validateRequiredField,
10
+ } from './common'
11
+
12
+ /**
13
+ * Deletes a Credential object.
14
+ *
15
+ * @category Transaction Models
16
+ * */
17
+ export interface CredentialDelete extends BaseTransaction {
18
+ TransactionType: 'CredentialDelete'
19
+
20
+ /** The transaction submitter. */
21
+ Account: string
22
+
23
+ /** A hex-encoded value to identify the type of credential from the issuer. */
24
+ CredentialType: string
25
+
26
+ /** The person that the credential is for. If omitted, Account is assumed to be the subject. */
27
+ Subject?: string
28
+
29
+ /** The issuer of the credential. If omitted, Account is assumed to be the issuer. */
30
+ Issuer?: string
31
+ }
32
+
33
+ /**
34
+ * Verify the form and type of a CredentialDelete at runtime.
35
+ *
36
+ * @param tx - A CredentialDelete Transaction.
37
+ * @throws When the CredentialDelete is Malformed.
38
+ */
39
+ export function validateCredentialDelete(tx: Record<string, unknown>): void {
40
+ validateBaseTransaction(tx)
41
+
42
+ if (!tx.Subject && !tx.Issuer) {
43
+ throw new ValidationError(
44
+ 'CredentialDelete: either `Issuer` or `Subject` must be provided',
45
+ )
46
+ }
47
+
48
+ validateRequiredField(tx, 'Account', isString)
49
+
50
+ validateCredentialType(tx)
51
+
52
+ validateOptionalField(tx, 'Subject', isString)
53
+
54
+ validateOptionalField(tx, 'Issuer', isString)
55
+ }
@@ -50,7 +50,7 @@ export interface MPTokenAuthorize extends BaseTransaction {
50
50
  * An optional XRPL Address of an individual token holder balance to lock/unlock.
51
51
  * If omitted, this transaction will apply to all any accounts holding MPTs.
52
52
  */
53
- MPTokenHolder?: Account
53
+ Holder?: Account
54
54
  Flags?: number | MPTokenAuthorizeFlagsInterface
55
55
  }
56
56
 
@@ -63,5 +63,5 @@ export interface MPTokenAuthorize extends BaseTransaction {
63
63
  export function validateMPTokenAuthorize(tx: Record<string, unknown>): void {
64
64
  validateBaseTransaction(tx)
65
65
  validateRequiredField(tx, 'MPTokenIssuanceID', isString)
66
- validateOptionalField(tx, 'MPTokenHolder', isAccount)
66
+ validateOptionalField(tx, 'Holder', isAccount)
67
67
  }
@@ -1,9 +1,20 @@
1
1
  import { ValidationError } from '../../errors'
2
- import { isHex } from '../utils'
2
+ import { isHex, INTEGER_SANITY_CHECK, isFlagEnabled } from '../utils'
3
3
 
4
- import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
4
+ import {
5
+ BaseTransaction,
6
+ GlobalFlags,
7
+ validateBaseTransaction,
8
+ validateOptionalField,
9
+ isString,
10
+ isNumber,
11
+ } from './common'
5
12
  import type { TransactionMetadataBase } from './metadata'
6
13
 
14
+ // 2^63 - 1
15
+ const MAX_AMT = '9223372036854775807'
16
+ const MAX_TRANSFER_FEE = 50000
17
+
7
18
  /**
8
19
  * Transaction Flags for an MPTokenIssuanceCreate Transaction.
9
20
  *
@@ -25,7 +36,7 @@ export enum MPTokenIssuanceCreateFlags {
25
36
  */
26
37
  tfMPTCanEscrow = 0x00000008,
27
38
  /**
28
- * If set, indicates that individual holders can trade their balances
39
+ * If set, indicates that individual holders can trade their balances
29
40
  * using the XRP Ledger DEX or AMM.
30
41
  */
31
42
  tfMPTCanTrade = 0x00000010,
@@ -75,17 +86,13 @@ export interface MPTokenIssuanceCreate extends BaseTransaction {
75
86
  */
76
87
  AssetScale?: number
77
88
  /**
78
- * Specifies the hex-encoded maximum asset amount of this token that should ever be issued.
79
- * It is a non-negative integer that can store a range of up to 63 bits. If not set, the max
80
- * amount will default to the largest unsigned 63-bit integer (0x7FFFFFFFFFFFFFFF)
81
- *
82
- * Helper function `mptUint64ToHex` can be used to help converting from base 10 or 16 string
83
- * to a valid value.
89
+ * Specifies the maximum asset amount of this token that should ever be issued.
90
+ * It is a non-negative integer string that can store a range of up to 63 bits. If not set, the max
91
+ * amount will default to the largest unsigned 63-bit integer (0x7FFFFFFFFFFFFFFF or 9223372036854775807)
84
92
  *
85
93
  * Example:
86
94
  * ```
87
- * MaximumAmount: '3e8' // 0x3E8 in hex or 1000 in decimal
88
- * MaximumAmount: mptUint64ToHex('1000') // 1000 in decimal using helper function
95
+ * MaximumAmount: '9223372036854775807'
89
96
  * ```
90
97
  */
91
98
  MaximumAmount?: string
@@ -107,6 +114,7 @@ export interface MPTokenIssuanceCreateMetadata extends TransactionMetadataBase {
107
114
  mpt_issuance_id?: string
108
115
  }
109
116
 
117
+ /* eslint-disable max-lines-per-function -- Not needed to reduce function */
110
118
  /**
111
119
  * Verify the form and type of an MPTokenIssuanceCreate at runtime.
112
120
  *
@@ -117,6 +125,10 @@ export function validateMPTokenIssuanceCreate(
117
125
  tx: Record<string, unknown>,
118
126
  ): void {
119
127
  validateBaseTransaction(tx)
128
+ validateOptionalField(tx, 'MaximumAmount', isString)
129
+ validateOptionalField(tx, 'MPTokenMetadata', isString)
130
+ validateOptionalField(tx, 'TransferFee', isNumber)
131
+ validateOptionalField(tx, 'AssetScale', isNumber)
120
132
 
121
133
  if (typeof tx.MPTokenMetadata === 'string' && tx.MPTokenMetadata === '') {
122
134
  throw new ValidationError(
@@ -129,4 +141,39 @@ export function validateMPTokenIssuanceCreate(
129
141
  'MPTokenIssuanceCreate: MPTokenMetadata must be in hex format',
130
142
  )
131
143
  }
144
+
145
+ if (typeof tx.MaximumAmount === 'string') {
146
+ if (!INTEGER_SANITY_CHECK.exec(tx.MaximumAmount)) {
147
+ throw new ValidationError('MPTokenIssuanceCreate: Invalid MaximumAmount')
148
+ } else if (
149
+ BigInt(tx.MaximumAmount) > BigInt(MAX_AMT) ||
150
+ BigInt(tx.MaximumAmount) < BigInt(`0`)
151
+ ) {
152
+ throw new ValidationError(
153
+ 'MPTokenIssuanceCreate: MaximumAmount out of range',
154
+ )
155
+ }
156
+ }
157
+
158
+ if (typeof tx.TransferFee === 'number') {
159
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Not necessary
160
+ const flags = tx.Flags as number | MPTokenIssuanceCreateFlagsInterface
161
+ const isTfMPTCanTransfer =
162
+ typeof flags === 'number'
163
+ ? isFlagEnabled(flags, MPTokenIssuanceCreateFlags.tfMPTCanTransfer)
164
+ : flags.tfMPTCanTransfer ?? false
165
+
166
+ if (tx.TransferFee < 0 || tx.TransferFee > MAX_TRANSFER_FEE) {
167
+ throw new ValidationError(
168
+ `MPTokenIssuanceCreate: TransferFee must be between 0 and ${MAX_TRANSFER_FEE}`,
169
+ )
170
+ }
171
+
172
+ if (tx.TransferFee && !isTfMPTCanTransfer) {
173
+ throw new ValidationError(
174
+ 'MPTokenIssuanceCreate: TransferFee cannot be provided without enabling tfMPTCanTransfer flag',
175
+ )
176
+ }
177
+ }
132
178
  }
179
+ /* eslint-enable max-lines-per-function */
@@ -1,3 +1,6 @@
1
+ import { ValidationError } from '../../errors'
2
+ import { isFlagEnabled } from '../utils'
3
+
1
4
  import {
2
5
  BaseTransaction,
3
6
  isString,
@@ -8,7 +11,6 @@ import {
8
11
  isAccount,
9
12
  GlobalFlags,
10
13
  } from './common'
11
- import { ValidationError } from '../../errors'
12
14
 
13
15
  /**
14
16
  * Transaction Flags for an MPTokenIssuanceSet Transaction.
@@ -51,7 +53,7 @@ export interface MPTokenIssuanceSet extends BaseTransaction {
51
53
  * An optional XRPL Address of an individual token holder balance to lock/unlock.
52
54
  * If omitted, this transaction will apply to all any accounts holding MPTs.
53
55
  */
54
- MPTokenHolder?: Account
56
+ Holder?: Account
55
57
  Flags?: number | MPTokenIssuanceSetFlagsInterface
56
58
  }
57
59
 
@@ -64,13 +66,21 @@ export interface MPTokenIssuanceSet extends BaseTransaction {
64
66
  export function validateMPTokenIssuanceSet(tx: Record<string, unknown>): void {
65
67
  validateBaseTransaction(tx)
66
68
  validateRequiredField(tx, 'MPTokenIssuanceID', isString)
67
- validateOptionalField(tx, 'MPTokenHolder', isAccount)
69
+ validateOptionalField(tx, 'Holder', isAccount)
70
+
71
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Not necessary
72
+ const flags = tx.Flags as number | MPTokenIssuanceSetFlagsInterface
73
+ const isTfMPTLock =
74
+ typeof flags === 'number'
75
+ ? isFlagEnabled(flags, MPTokenIssuanceSetFlags.tfMPTLock)
76
+ : flags.tfMPTLock ?? false
77
+
78
+ const isTfMPTUnlock =
79
+ typeof flags === 'number'
80
+ ? isFlagEnabled(flags, MPTokenIssuanceSetFlags.tfMPTUnlock)
81
+ : flags.tfMPTUnlock ?? false
68
82
 
69
- const flags = tx.Flags as number
70
- if (
71
- BigInt(flags) & BigInt(MPTokenIssuanceSetFlags.tfMPTLock) &&
72
- BigInt(flags) & BigInt(MPTokenIssuanceSetFlags.tfMPTUnlock)
73
- ) {
83
+ if (isTfMPTLock && isTfMPTUnlock) {
74
84
  throw new ValidationError('MPTokenIssuanceSet: flag conflict')
75
85
  }
76
86
  }
@@ -4,6 +4,7 @@ import {
4
4
  isAccount,
5
5
  isNumber,
6
6
  validateBaseTransaction,
7
+ validateCredentialsList,
7
8
  validateOptionalField,
8
9
  validateRequiredField,
9
10
  } from './common'
@@ -28,6 +29,12 @@ export interface AccountDelete extends BaseTransaction {
28
29
  * information for the recipient of the deleted account's leftover XRP.
29
30
  */
30
31
  DestinationTag?: number
32
+ /**
33
+ * Credentials associated with sender of this transaction. The credentials included
34
+ * must not be expired. The list must not be empty when specified and cannot contain
35
+ * more than 8 credentials.
36
+ */
37
+ CredentialIDs?: string[]
31
38
  }
32
39
 
33
40
  /**
@@ -41,4 +48,11 @@ export function validateAccountDelete(tx: Record<string, unknown>): void {
41
48
 
42
49
  validateRequiredField(tx, 'Destination', isAccount)
43
50
  validateOptionalField(tx, 'DestinationTag', isNumber)
51
+
52
+ validateCredentialsList(
53
+ tx.CredentialIDs,
54
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
55
+ tx.TransactionType as string,
56
+ true,
57
+ )
44
58
  }
@@ -31,7 +31,7 @@ export interface Clawback extends BaseTransaction {
31
31
  * Indicates the AccountID that the issuer wants to clawback. This field is only valid for clawing back
32
32
  * MPTs.
33
33
  */
34
- MPTokenHolder?: string
34
+ Holder?: string
35
35
  }
36
36
 
37
37
  /**
@@ -42,7 +42,7 @@ export interface Clawback extends BaseTransaction {
42
42
  */
43
43
  export function validateClawback(tx: Record<string, unknown>): void {
44
44
  validateBaseTransaction(tx)
45
- validateOptionalField(tx, 'MPTokenHolder', isAccount)
45
+ validateOptionalField(tx, 'Holder', isAccount)
46
46
 
47
47
  if (tx.Amount == null) {
48
48
  throw new ValidationError('Clawback: missing field Amount')
@@ -56,17 +56,15 @@ export function validateClawback(tx: Record<string, unknown>): void {
56
56
  throw new ValidationError('Clawback: invalid holder Account')
57
57
  }
58
58
 
59
- if (isMPTAmount(tx.Amount) && tx.Account === tx.MPTokenHolder) {
59
+ if (isMPTAmount(tx.Amount) && tx.Account === tx.Holder) {
60
60
  throw new ValidationError('Clawback: invalid holder Account')
61
61
  }
62
62
 
63
- if (isIssuedCurrency(tx.Amount) && tx.MPTokenHolder) {
64
- throw new ValidationError(
65
- 'Clawback: cannot have MPTokenHolder for currency',
66
- )
63
+ if (isIssuedCurrency(tx.Amount) && tx.Holder) {
64
+ throw new ValidationError('Clawback: cannot have Holder for currency')
67
65
  }
68
66
 
69
- if (isMPTAmount(tx.Amount) && !tx.MPTokenHolder) {
70
- throw new ValidationError('Clawback: missing MPTokenHolder')
67
+ if (isMPTAmount(tx.Amount) && !tx.Holder) {
68
+ throw new ValidationError('Clawback: missing Holder')
71
69
  }
72
70
  }