xrpl 3.1.0 → 4.0.0-mpt-beta

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 (341) hide show
  1. package/README.md +3 -3
  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 +394 -710
  5. package/build/xrpl-latest.js.map +1 -1
  6. package/dist/npm/Wallet/defaultFaucets.d.ts +1 -2
  7. package/dist/npm/Wallet/defaultFaucets.d.ts.map +1 -1
  8. package/dist/npm/Wallet/defaultFaucets.js +0 -5
  9. package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
  10. package/dist/npm/Wallet/fundWallet.d.ts.map +1 -1
  11. package/dist/npm/Wallet/fundWallet.js +1 -5
  12. package/dist/npm/Wallet/fundWallet.js.map +1 -1
  13. package/dist/npm/client/RequestManager.d.ts +5 -4
  14. package/dist/npm/client/RequestManager.d.ts.map +1 -1
  15. package/dist/npm/client/RequestManager.js.map +1 -1
  16. package/dist/npm/client/connection.d.ts +2 -2
  17. package/dist/npm/client/connection.d.ts.map +1 -1
  18. package/dist/npm/client/connection.js.map +1 -1
  19. package/dist/npm/client/index.d.ts +4 -3
  20. package/dist/npm/client/index.d.ts.map +1 -1
  21. package/dist/npm/client/index.js +16 -4
  22. package/dist/npm/client/index.js.map +1 -1
  23. package/dist/npm/client/partialPayment.d.ts +2 -1
  24. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  25. package/dist/npm/client/partialPayment.js +19 -3
  26. package/dist/npm/client/partialPayment.js.map +1 -1
  27. package/dist/npm/models/common/index.d.ts +9 -0
  28. package/dist/npm/models/common/index.d.ts.map +1 -1
  29. package/dist/npm/models/common/index.js +4 -0
  30. package/dist/npm/models/common/index.js.map +1 -1
  31. package/dist/npm/models/index.d.ts +1 -1
  32. package/dist/npm/models/index.d.ts.map +1 -1
  33. package/dist/npm/models/index.js +2 -1
  34. package/dist/npm/models/index.js.map +1 -1
  35. package/dist/npm/models/ledger/AMM.d.ts +2 -2
  36. package/dist/npm/models/ledger/AMM.d.ts.map +1 -1
  37. package/dist/npm/models/ledger/Amendments.d.ts +2 -2
  38. package/dist/npm/models/ledger/Amendments.d.ts.map +1 -1
  39. package/dist/npm/models/ledger/BaseLedgerEntry.d.ts +3 -3
  40. package/dist/npm/models/ledger/BaseLedgerEntry.d.ts.map +1 -1
  41. package/dist/npm/models/ledger/DirectoryNode.d.ts +2 -2
  42. package/dist/npm/models/ledger/DirectoryNode.d.ts.map +1 -1
  43. package/dist/npm/models/ledger/FeeSettings.d.ts +2 -2
  44. package/dist/npm/models/ledger/FeeSettings.d.ts.map +1 -1
  45. package/dist/npm/models/ledger/Ledger.d.ts +11 -2
  46. package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
  47. package/dist/npm/models/ledger/LedgerEntry.d.ts +1 -1
  48. package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
  49. package/dist/npm/models/ledger/LedgerHashes.d.ts +2 -2
  50. package/dist/npm/models/ledger/LedgerHashes.d.ts.map +1 -1
  51. package/dist/npm/models/ledger/MPToken.d.ts +11 -0
  52. package/dist/npm/models/ledger/MPToken.d.ts.map +1 -0
  53. package/dist/npm/models/ledger/MPToken.js +3 -0
  54. package/dist/npm/models/ledger/MPToken.js.map +1 -0
  55. package/dist/npm/models/ledger/MPTokenIssuance.d.ts +14 -0
  56. package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -0
  57. package/dist/npm/models/ledger/MPTokenIssuance.js +3 -0
  58. package/dist/npm/models/ledger/MPTokenIssuance.js.map +1 -0
  59. package/dist/npm/models/ledger/NegativeUNL.d.ts +2 -2
  60. package/dist/npm/models/ledger/NegativeUNL.d.ts.map +1 -1
  61. package/dist/npm/models/ledger/index.d.ts +4 -2
  62. package/dist/npm/models/ledger/index.d.ts.map +1 -1
  63. package/dist/npm/models/ledger/index.js.map +1 -1
  64. package/dist/npm/models/methods/accountInfo.d.ts +17 -4
  65. package/dist/npm/models/methods/accountInfo.d.ts.map +1 -1
  66. package/dist/npm/models/methods/accountTx.d.ts +11 -5
  67. package/dist/npm/models/methods/accountTx.d.ts.map +1 -1
  68. package/dist/npm/models/methods/feature.d.ts +28 -0
  69. package/dist/npm/models/methods/feature.d.ts.map +1 -0
  70. package/dist/npm/models/methods/feature.js +3 -0
  71. package/dist/npm/models/methods/feature.js.map +1 -0
  72. package/dist/npm/models/methods/index.d.ts +14 -11
  73. package/dist/npm/models/methods/index.d.ts.map +1 -1
  74. package/dist/npm/models/methods/ledger.d.ts +17 -5
  75. package/dist/npm/models/methods/ledger.d.ts.map +1 -1
  76. package/dist/npm/models/methods/ledgerEntry.d.ts +5 -0
  77. package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
  78. package/dist/npm/models/methods/nftsByIssuer.d.ts +19 -0
  79. package/dist/npm/models/methods/nftsByIssuer.d.ts.map +1 -0
  80. package/dist/npm/models/methods/nftsByIssuer.js +3 -0
  81. package/dist/npm/models/methods/nftsByIssuer.js.map +1 -0
  82. package/dist/npm/models/methods/submitMultisigned.d.ts +16 -5
  83. package/dist/npm/models/methods/submitMultisigned.d.ts.map +1 -1
  84. package/dist/npm/models/methods/tx.d.ts +20 -8
  85. package/dist/npm/models/methods/tx.d.ts.map +1 -1
  86. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts +15 -0
  87. package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.map +1 -0
  88. package/dist/npm/models/transactions/MPTokenAuthorize.js +15 -0
  89. package/dist/npm/models/transactions/MPTokenAuthorize.js.map +1 -0
  90. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +31 -0
  91. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -0
  92. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +26 -0
  93. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -0
  94. package/dist/npm/models/transactions/MPTokenIssuanceDestroy.d.ts +7 -0
  95. package/dist/npm/models/transactions/MPTokenIssuanceDestroy.d.ts.map +1 -0
  96. package/dist/npm/models/transactions/MPTokenIssuanceDestroy.js +10 -0
  97. package/dist/npm/models/transactions/MPTokenIssuanceDestroy.js.map +1 -0
  98. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +17 -0
  99. package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -0
  100. package/dist/npm/models/transactions/MPTokenIssuanceSet.js +22 -0
  101. package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -0
  102. package/dist/npm/models/transactions/clawback.d.ts +3 -2
  103. package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
  104. package/dist/npm/models/transactions/clawback.js +11 -1
  105. package/dist/npm/models/transactions/clawback.js.map +1 -1
  106. package/dist/npm/models/transactions/common.d.ts +2 -1
  107. package/dist/npm/models/transactions/common.d.ts.map +1 -1
  108. package/dist/npm/models/transactions/common.js +12 -2
  109. package/dist/npm/models/transactions/common.js.map +1 -1
  110. package/dist/npm/models/transactions/index.d.ts +5 -1
  111. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  112. package/dist/npm/models/transactions/index.js +9 -1
  113. package/dist/npm/models/transactions/index.js.map +1 -1
  114. package/dist/npm/models/transactions/metadata.d.ts +5 -4
  115. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  116. package/dist/npm/models/transactions/metadata.js.map +1 -1
  117. package/dist/npm/models/transactions/payment.d.ts +4 -4
  118. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  119. package/dist/npm/models/transactions/transaction.d.ts +5 -1
  120. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  121. package/dist/npm/models/transactions/transaction.js +16 -0
  122. package/dist/npm/models/transactions/transaction.js.map +1 -1
  123. package/dist/npm/models/utils/flags.d.ts +1 -0
  124. package/dist/npm/models/utils/flags.d.ts.map +1 -1
  125. package/dist/npm/models/utils/flags.js +23 -1
  126. package/dist/npm/models/utils/flags.js.map +1 -1
  127. package/dist/npm/snippets/src/claimPayChannel.js +1 -1
  128. package/dist/npm/snippets/src/claimPayChannel.js.map +1 -1
  129. package/dist/npm/snippets/src/sendEscrow.js +1 -1
  130. package/dist/npm/snippets/src/sendEscrow.js.map +1 -1
  131. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  132. package/dist/npm/src/Wallet/defaultFaucets.d.ts +1 -2
  133. package/dist/npm/src/Wallet/defaultFaucets.d.ts.map +1 -1
  134. package/dist/npm/src/Wallet/defaultFaucets.js +0 -5
  135. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  136. package/dist/npm/src/Wallet/fundWallet.d.ts.map +1 -1
  137. package/dist/npm/src/Wallet/fundWallet.js +1 -5
  138. package/dist/npm/src/Wallet/fundWallet.js.map +1 -1
  139. package/dist/npm/src/client/RequestManager.d.ts +5 -4
  140. package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
  141. package/dist/npm/src/client/RequestManager.js.map +1 -1
  142. package/dist/npm/src/client/connection.d.ts +2 -2
  143. package/dist/npm/src/client/connection.d.ts.map +1 -1
  144. package/dist/npm/src/client/connection.js.map +1 -1
  145. package/dist/npm/src/client/index.d.ts +4 -3
  146. package/dist/npm/src/client/index.d.ts.map +1 -1
  147. package/dist/npm/src/client/index.js +16 -4
  148. package/dist/npm/src/client/index.js.map +1 -1
  149. package/dist/npm/src/client/partialPayment.d.ts +2 -1
  150. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  151. package/dist/npm/src/client/partialPayment.js +19 -3
  152. package/dist/npm/src/client/partialPayment.js.map +1 -1
  153. package/dist/npm/src/models/common/index.d.ts +9 -0
  154. package/dist/npm/src/models/common/index.d.ts.map +1 -1
  155. package/dist/npm/src/models/common/index.js +4 -0
  156. package/dist/npm/src/models/common/index.js.map +1 -1
  157. package/dist/npm/src/models/index.d.ts +1 -1
  158. package/dist/npm/src/models/index.d.ts.map +1 -1
  159. package/dist/npm/src/models/index.js +2 -1
  160. package/dist/npm/src/models/index.js.map +1 -1
  161. package/dist/npm/src/models/ledger/AMM.d.ts +2 -2
  162. package/dist/npm/src/models/ledger/AMM.d.ts.map +1 -1
  163. package/dist/npm/src/models/ledger/Amendments.d.ts +2 -2
  164. package/dist/npm/src/models/ledger/Amendments.d.ts.map +1 -1
  165. package/dist/npm/src/models/ledger/BaseLedgerEntry.d.ts +3 -3
  166. package/dist/npm/src/models/ledger/BaseLedgerEntry.d.ts.map +1 -1
  167. package/dist/npm/src/models/ledger/DirectoryNode.d.ts +2 -2
  168. package/dist/npm/src/models/ledger/DirectoryNode.d.ts.map +1 -1
  169. package/dist/npm/src/models/ledger/FeeSettings.d.ts +2 -2
  170. package/dist/npm/src/models/ledger/FeeSettings.d.ts.map +1 -1
  171. package/dist/npm/src/models/ledger/Ledger.d.ts +11 -2
  172. package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
  173. package/dist/npm/src/models/ledger/LedgerEntry.d.ts +1 -1
  174. package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
  175. package/dist/npm/src/models/ledger/LedgerHashes.d.ts +2 -2
  176. package/dist/npm/src/models/ledger/LedgerHashes.d.ts.map +1 -1
  177. package/dist/npm/src/models/ledger/MPToken.d.ts +11 -0
  178. package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -0
  179. package/dist/npm/src/models/ledger/MPToken.js +3 -0
  180. package/dist/npm/src/models/ledger/MPToken.js.map +1 -0
  181. package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +14 -0
  182. package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -0
  183. package/dist/npm/src/models/ledger/MPTokenIssuance.js +3 -0
  184. package/dist/npm/src/models/ledger/MPTokenIssuance.js.map +1 -0
  185. package/dist/npm/src/models/ledger/NegativeUNL.d.ts +2 -2
  186. package/dist/npm/src/models/ledger/NegativeUNL.d.ts.map +1 -1
  187. package/dist/npm/src/models/ledger/index.d.ts +4 -2
  188. package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
  189. package/dist/npm/src/models/ledger/index.js.map +1 -1
  190. package/dist/npm/src/models/methods/accountInfo.d.ts +17 -4
  191. package/dist/npm/src/models/methods/accountInfo.d.ts.map +1 -1
  192. package/dist/npm/src/models/methods/accountTx.d.ts +11 -5
  193. package/dist/npm/src/models/methods/accountTx.d.ts.map +1 -1
  194. package/dist/npm/src/models/methods/feature.d.ts +28 -0
  195. package/dist/npm/src/models/methods/feature.d.ts.map +1 -0
  196. package/dist/npm/src/models/methods/feature.js +3 -0
  197. package/dist/npm/src/models/methods/feature.js.map +1 -0
  198. package/dist/npm/src/models/methods/index.d.ts +14 -11
  199. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  200. package/dist/npm/src/models/methods/ledger.d.ts +17 -5
  201. package/dist/npm/src/models/methods/ledger.d.ts.map +1 -1
  202. package/dist/npm/src/models/methods/ledgerEntry.d.ts +5 -0
  203. package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
  204. package/dist/npm/src/models/methods/nftsByIssuer.d.ts +19 -0
  205. package/dist/npm/src/models/methods/nftsByIssuer.d.ts.map +1 -0
  206. package/dist/npm/src/models/methods/nftsByIssuer.js +3 -0
  207. package/dist/npm/src/models/methods/nftsByIssuer.js.map +1 -0
  208. package/dist/npm/src/models/methods/submitMultisigned.d.ts +16 -5
  209. package/dist/npm/src/models/methods/submitMultisigned.d.ts.map +1 -1
  210. package/dist/npm/src/models/methods/tx.d.ts +20 -8
  211. package/dist/npm/src/models/methods/tx.d.ts.map +1 -1
  212. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts +15 -0
  213. package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.map +1 -0
  214. package/dist/npm/src/models/transactions/MPTokenAuthorize.js +15 -0
  215. package/dist/npm/src/models/transactions/MPTokenAuthorize.js.map +1 -0
  216. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +31 -0
  217. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -0
  218. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +26 -0
  219. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -0
  220. package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.d.ts +7 -0
  221. package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.d.ts.map +1 -0
  222. package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.js +10 -0
  223. package/dist/npm/src/models/transactions/MPTokenIssuanceDestroy.js.map +1 -0
  224. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +17 -0
  225. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -0
  226. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +22 -0
  227. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -0
  228. package/dist/npm/src/models/transactions/clawback.d.ts +3 -2
  229. package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
  230. package/dist/npm/src/models/transactions/clawback.js +11 -1
  231. package/dist/npm/src/models/transactions/clawback.js.map +1 -1
  232. package/dist/npm/src/models/transactions/common.d.ts +2 -1
  233. package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
  234. package/dist/npm/src/models/transactions/common.js +12 -2
  235. package/dist/npm/src/models/transactions/common.js.map +1 -1
  236. package/dist/npm/src/models/transactions/index.d.ts +5 -1
  237. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  238. package/dist/npm/src/models/transactions/index.js +9 -1
  239. package/dist/npm/src/models/transactions/index.js.map +1 -1
  240. package/dist/npm/src/models/transactions/metadata.d.ts +5 -4
  241. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  242. package/dist/npm/src/models/transactions/metadata.js.map +1 -1
  243. package/dist/npm/src/models/transactions/payment.d.ts +4 -4
  244. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  245. package/dist/npm/src/models/transactions/transaction.d.ts +5 -1
  246. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  247. package/dist/npm/src/models/transactions/transaction.js +16 -0
  248. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  249. package/dist/npm/src/models/utils/flags.d.ts +1 -0
  250. package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
  251. package/dist/npm/src/models/utils/flags.js +23 -1
  252. package/dist/npm/src/models/utils/flags.js.map +1 -1
  253. package/dist/npm/src/sugar/autofill.d.ts +1 -1
  254. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  255. package/dist/npm/src/sugar/autofill.js +2 -4
  256. package/dist/npm/src/sugar/autofill.js.map +1 -1
  257. package/dist/npm/src/sugar/getFeeXrp.d.ts +1 -1
  258. package/dist/npm/src/sugar/getFeeXrp.d.ts.map +1 -1
  259. package/dist/npm/src/sugar/getFeeXrp.js +3 -2
  260. package/dist/npm/src/sugar/getFeeXrp.js.map +1 -1
  261. package/dist/npm/src/sugar/submit.d.ts.map +1 -1
  262. package/dist/npm/src/sugar/submit.js.map +1 -1
  263. package/dist/npm/src/utils/hashes/hashLedger.d.ts +4 -3
  264. package/dist/npm/src/utils/hashes/hashLedger.d.ts.map +1 -1
  265. package/dist/npm/src/utils/hashes/hashLedger.js.map +1 -1
  266. package/dist/npm/src/utils/index.d.ts +4 -2
  267. package/dist/npm/src/utils/index.d.ts.map +1 -1
  268. package/dist/npm/src/utils/index.js +3 -1
  269. package/dist/npm/src/utils/index.js.map +1 -1
  270. package/dist/npm/src/utils/mptConversion.d.ts +2 -0
  271. package/dist/npm/src/utils/mptConversion.d.ts.map +1 -0
  272. package/dist/npm/src/utils/mptConversion.js +31 -0
  273. package/dist/npm/src/utils/mptConversion.js.map +1 -0
  274. package/dist/npm/sugar/autofill.d.ts +1 -1
  275. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  276. package/dist/npm/sugar/autofill.js +2 -4
  277. package/dist/npm/sugar/autofill.js.map +1 -1
  278. package/dist/npm/sugar/getFeeXrp.d.ts +1 -1
  279. package/dist/npm/sugar/getFeeXrp.d.ts.map +1 -1
  280. package/dist/npm/sugar/getFeeXrp.js +3 -2
  281. package/dist/npm/sugar/getFeeXrp.js.map +1 -1
  282. package/dist/npm/sugar/submit.d.ts.map +1 -1
  283. package/dist/npm/sugar/submit.js.map +1 -1
  284. package/dist/npm/utils/hashes/hashLedger.d.ts +4 -3
  285. package/dist/npm/utils/hashes/hashLedger.d.ts.map +1 -1
  286. package/dist/npm/utils/hashes/hashLedger.js.map +1 -1
  287. package/dist/npm/utils/index.d.ts +4 -2
  288. package/dist/npm/utils/index.d.ts.map +1 -1
  289. package/dist/npm/utils/index.js +3 -1
  290. package/dist/npm/utils/index.js.map +1 -1
  291. package/dist/npm/utils/mptConversion.d.ts +2 -0
  292. package/dist/npm/utils/mptConversion.d.ts.map +1 -0
  293. package/dist/npm/utils/mptConversion.js +31 -0
  294. package/dist/npm/utils/mptConversion.js.map +1 -0
  295. package/package.json +6 -7
  296. package/src/Wallet/defaultFaucets.ts +0 -6
  297. package/src/Wallet/fundWallet.ts +0 -1
  298. package/src/client/RequestManager.ts +17 -12
  299. package/src/client/connection.ts +7 -5
  300. package/src/client/index.ts +63 -16
  301. package/src/client/partialPayment.ts +55 -17
  302. package/src/models/common/index.ts +13 -0
  303. package/src/models/index.ts +1 -0
  304. package/src/models/ledger/AMM.ts +2 -2
  305. package/src/models/ledger/Amendments.ts +2 -2
  306. package/src/models/ledger/BaseLedgerEntry.ts +9 -5
  307. package/src/models/ledger/DirectoryNode.ts +2 -2
  308. package/src/models/ledger/FeeSettings.ts +4 -2
  309. package/src/models/ledger/Ledger.ts +46 -9
  310. package/src/models/ledger/LedgerEntry.ts +2 -0
  311. package/src/models/ledger/LedgerHashes.ts +2 -4
  312. package/src/models/ledger/MPToken.ts +12 -0
  313. package/src/models/ledger/MPTokenIssuance.ts +14 -0
  314. package/src/models/ledger/NegativeUNL.ts +2 -2
  315. package/src/models/ledger/index.ts +6 -1
  316. package/src/models/methods/accountInfo.ts +58 -12
  317. package/src/models/methods/accountTx.ts +49 -8
  318. package/src/models/methods/feature.ts +68 -0
  319. package/src/models/methods/index.ts +67 -23
  320. package/src/models/methods/ledger.ts +41 -5
  321. package/src/models/methods/ledgerEntry.ts +16 -0
  322. package/src/models/methods/nftsByIssuer.ts +68 -0
  323. package/src/models/methods/submitMultisigned.ts +48 -16
  324. package/src/models/methods/tx.ts +74 -22
  325. package/src/models/transactions/MPTokenAuthorize.ts +67 -0
  326. package/src/models/transactions/MPTokenIssuanceCreate.ts +132 -0
  327. package/src/models/transactions/MPTokenIssuanceDestroy.ts +34 -0
  328. package/src/models/transactions/MPTokenIssuanceSet.ts +76 -0
  329. package/src/models/transactions/clawback.ts +29 -6
  330. package/src/models/transactions/common.ts +22 -1
  331. package/src/models/transactions/index.ts +17 -1
  332. package/src/models/transactions/metadata.ts +9 -3
  333. package/src/models/transactions/payment.ts +4 -4
  334. package/src/models/transactions/transaction.ts +33 -0
  335. package/src/models/utils/flags.ts +33 -1
  336. package/src/sugar/autofill.ts +4 -10
  337. package/src/sugar/getFeeXrp.ts +6 -3
  338. package/src/sugar/submit.ts +5 -3
  339. package/src/utils/hashes/hashLedger.ts +8 -5
  340. package/src/utils/index.ts +4 -1
  341. package/src/utils/mptConversion.ts +61 -0
@@ -2,21 +2,27 @@ import BigNumber from 'bignumber.js'
2
2
  import { decode } from 'ripple-binary-codec'
3
3
 
4
4
  import type {
5
- AccountTxResponse,
6
5
  TransactionEntryResponse,
7
6
  TransactionStream,
8
7
  TxResponse,
9
8
  } from '..'
10
- import type { Amount } from '../models/common'
11
- import type { RequestResponseMap } from '../models/methods'
9
+ import type { Amount, IssuedCurrency,APIVersion, DEFAULT_API_VERSION , MPTAmount } from '../models/common'
10
+ import type {
11
+ AccountTxTransaction,
12
+ RequestResponseMap,
13
+ } from '../models/methods'
14
+ import { AccountTxVersionResponseMap } from '../models/methods/accountTx'
12
15
  import { BaseRequest, BaseResponse } from '../models/methods/baseMethod'
13
- import { PaymentFlags, Transaction } from '../models/transactions'
16
+ import { PaymentFlags, Transaction, isMPTAmount } from '../models/transactions'
14
17
  import type { TransactionMetadata } from '../models/transactions/metadata'
15
18
  import { isFlagEnabled } from '../models/utils'
16
19
 
17
20
  const WARN_PARTIAL_PAYMENT_CODE = 2001
18
21
 
19
- function amountsEqual(amt1: Amount, amt2: Amount): boolean {
22
+ function amountsEqual(
23
+ amt1: Amount | MPTAmount,
24
+ amt2: Amount | MPTAmount,
25
+ ): boolean {
20
26
  if (typeof amt1 === 'string' && typeof amt2 === 'string') {
21
27
  return amt1 === amt2
22
28
  }
@@ -25,12 +31,26 @@ function amountsEqual(amt1: Amount, amt2: Amount): boolean {
25
31
  return false
26
32
  }
27
33
 
34
+ if (isMPTAmount(amt1) && isMPTAmount(amt2)) {
35
+ const aValue = new BigNumber(amt1.value)
36
+ const bValue = new BigNumber(amt2.value)
37
+
38
+ return (
39
+ (amt1 as MPTAmount).mpt_issuance_id ===
40
+ (amt2 as MPTAmount).mpt_issuance_id && aValue.isEqualTo(bValue)
41
+ )
42
+ }
43
+
44
+ if (isMPTAmount(amt1) || isMPTAmount(amt2)) {
45
+ return false
46
+ }
47
+
28
48
  const aValue = new BigNumber(amt1.value)
29
49
  const bValue = new BigNumber(amt2.value)
30
50
 
31
51
  return (
32
- amt1.currency === amt2.currency &&
33
- amt1.issuer === amt2.issuer &&
52
+ (amt1 as IssuedCurrency).currency === (amt2 as IssuedCurrency).currency &&
53
+ (amt1 as IssuedCurrency).issuer === (amt2 as IssuedCurrency).issuer &&
34
54
  aValue.isEqualTo(bValue)
35
55
  )
36
56
  }
@@ -63,7 +83,10 @@ function isPartialPayment(
63
83
  }
64
84
 
65
85
  const delivered = meta.delivered_amount
66
- const amount = tx.Amount
86
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- DeliverMax is a valid field on Payment response
87
+ // @ts-expect-error -- DeliverMax is a valid field on Payment response
88
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- DeliverMax is a valid field on Payment response
89
+ const amount = tx.DeliverMax
67
90
 
68
91
  if (delivered === undefined) {
69
92
  return false
@@ -73,23 +96,36 @@ function isPartialPayment(
73
96
  }
74
97
 
75
98
  function txHasPartialPayment(response: TxResponse): boolean {
76
- return isPartialPayment(response.result, response.result.meta)
99
+ return isPartialPayment(response.result.tx_json, response.result.meta)
77
100
  }
78
101
 
79
102
  function txEntryHasPartialPayment(response: TransactionEntryResponse): boolean {
80
103
  return isPartialPayment(response.result.tx_json, response.result.metadata)
81
104
  }
82
105
 
83
- function accountTxHasPartialPayment(response: AccountTxResponse): boolean {
106
+ function accountTxHasPartialPayment<
107
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
108
+ >(response: AccountTxVersionResponseMap<Version>): boolean {
84
109
  const { transactions } = response.result
85
- const foo = transactions.some((tx) => isPartialPayment(tx.tx, tx.meta))
110
+ const foo = transactions.some((tx) => {
111
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- required to check API version model
112
+ if (tx.tx_json != null) {
113
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- use API v2 model
114
+ const transaction = tx as AccountTxTransaction
115
+ return isPartialPayment(transaction.tx_json, transaction.meta)
116
+ }
117
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- use API v1 model
118
+ const transaction = tx as AccountTxTransaction<1>
119
+ return isPartialPayment(transaction.tx, transaction.meta)
120
+ })
86
121
  return foo
87
122
  }
88
123
 
89
- function hasPartialPayment<R extends BaseRequest, T = RequestResponseMap<R>>(
90
- command: string,
91
- response: T,
92
- ): boolean {
124
+ function hasPartialPayment<
125
+ R extends BaseRequest,
126
+ V extends APIVersion = typeof DEFAULT_API_VERSION,
127
+ T = RequestResponseMap<R, V>,
128
+ >(command: string, response: T): boolean {
93
129
  /* eslint-disable @typescript-eslint/consistent-type-assertions -- Request type is known at runtime from command */
94
130
  switch (command) {
95
131
  case 'tx':
@@ -97,7 +133,9 @@ function hasPartialPayment<R extends BaseRequest, T = RequestResponseMap<R>>(
97
133
  case 'transaction_entry':
98
134
  return txEntryHasPartialPayment(response as TransactionEntryResponse)
99
135
  case 'account_tx':
100
- return accountTxHasPartialPayment(response as AccountTxResponse)
136
+ return accountTxHasPartialPayment(
137
+ response as AccountTxVersionResponseMap<V>,
138
+ )
101
139
  default:
102
140
  return false
103
141
  }
@@ -112,7 +150,7 @@ function hasPartialPayment<R extends BaseRequest, T = RequestResponseMap<R>>(
112
150
  */
113
151
  export function handlePartialPayment<
114
152
  R extends BaseRequest,
115
- T = RequestResponseMap<R>,
153
+ T = RequestResponseMap<R, APIVersion>,
116
154
  >(command: string, response: T): void {
117
155
  if (hasPartialPayment(command, response)) {
118
156
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We are checking dynamically and safely.
@@ -1,3 +1,7 @@
1
+ export const RIPPLED_API_V1 = 1
2
+ export const RIPPLED_API_V2 = 2
3
+ export const DEFAULT_API_VERSION = RIPPLED_API_V2
4
+ export type APIVersion = typeof RIPPLED_API_V1 | typeof RIPPLED_API_V2
1
5
  export type LedgerIndex = number | ('validated' | 'closed' | 'current')
2
6
 
3
7
  export interface XRP {
@@ -16,6 +20,11 @@ export interface IssuedCurrencyAmount extends IssuedCurrency {
16
20
  value: string
17
21
  }
18
22
 
23
+ export interface MPTAmount {
24
+ mpt_issuance_id: string
25
+ value: string
26
+ }
27
+
19
28
  export type Amount = IssuedCurrencyAmount | string
20
29
 
21
30
  export interface Balance {
@@ -104,6 +113,10 @@ export interface ResponseOnlyTxInfo {
104
113
  * The sequence number of the ledger that included this transaction.
105
114
  */
106
115
  ledger_index?: number
116
+ /**
117
+ * The hash of the ledger included this transaction.
118
+ */
119
+ ledger_hash?: string
107
120
  /**
108
121
  * @deprecated Alias for ledger_index.
109
122
  */
@@ -10,6 +10,7 @@ export * as LedgerEntry from './ledger'
10
10
  export {
11
11
  setTransactionFlagsToNumber,
12
12
  parseAccountRootFlags,
13
+ parseTransactionFlags,
13
14
  } from './utils/flags'
14
15
  export * from './methods'
15
16
  export * from './transactions'
@@ -1,6 +1,6 @@
1
1
  import { AuthAccount, Currency, IssuedCurrencyAmount } from '../common'
2
2
 
3
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
3
+ import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'
4
4
 
5
5
  export interface VoteSlot {
6
6
  VoteEntry: {
@@ -15,7 +15,7 @@ export interface VoteSlot {
15
15
  *
16
16
  * @category Ledger Entries
17
17
  */
18
- export default interface AMM extends BaseLedgerEntry, MissingPreviousTxnID {
18
+ export default interface AMM extends BaseLedgerEntry, HasOptionalPreviousTxnID {
19
19
  LedgerEntryType: 'AMM'
20
20
  /**
21
21
  * The address of the special account that holds this AMM's assets.
@@ -1,4 +1,4 @@
1
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
1
+ import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'
2
2
 
3
3
  /**
4
4
  * The unique id for the Amendments object https://xrpl.org/amendments-object.html#amendments-id-format
@@ -26,7 +26,7 @@ export interface Majority {
26
26
  */
27
27
  export default interface Amendments
28
28
  extends BaseLedgerEntry,
29
- MissingPreviousTxnID {
29
+ HasOptionalPreviousTxnID {
30
30
  LedgerEntryType: 'Amendments'
31
31
  /**
32
32
  * Array of 256-bit amendment IDs for all currently-enabled amendments. If
@@ -15,13 +15,17 @@ export interface HasPreviousTxnID {
15
15
  PreviousTxnLgrSeq: number
16
16
  }
17
17
 
18
- export interface MissingPreviousTxnID {
18
+ export interface HasOptionalPreviousTxnID {
19
19
  /**
20
- * This field is missing on this object but is present on most other returned objects.
20
+ * The identifying hash of the transaction that most recently modified this
21
+ * object. This field was added in the `fixPreviousTxnID` amendment, so it
22
+ * may not be present in every object.
21
23
  */
22
- PreviousTxnID: never
24
+ PreviousTxnID?: string
23
25
  /**
24
- * This field is missing on this object but is present on most other returned objects.
26
+ * The index of the ledger that contains the transaction that most recently
27
+ * modified this object. This field was added in the `fixPreviousTxnID`
28
+ * amendment, so it may not be present in every object.
25
29
  */
26
- PreviousTxnLgrSeq: never
30
+ PreviousTxnLgrSeq?: number
27
31
  }
@@ -1,4 +1,4 @@
1
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
1
+ import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'
2
2
 
3
3
  /**
4
4
  * The DirectoryNode object type provides a list of links to other objects in
@@ -8,7 +8,7 @@ import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
8
8
  */
9
9
  export default interface DirectoryNode
10
10
  extends BaseLedgerEntry,
11
- MissingPreviousTxnID {
11
+ HasOptionalPreviousTxnID {
12
12
  LedgerEntryType: 'DirectoryNode'
13
13
  /**
14
14
  * A bit-map of boolean flags enabled for this directory. Currently, the
@@ -1,4 +1,4 @@
1
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
1
+ import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'
2
2
 
3
3
  /**
4
4
  * The unique id for the FeeSettings object https://xrpl.org/feesettings.html#feesettings-id-format
@@ -26,7 +26,9 @@ export interface FeeSettingsPostAmendmentFields {
26
26
  ReserveIncrementDrops: string
27
27
  }
28
28
 
29
- export interface FeeSettingsBase extends BaseLedgerEntry, MissingPreviousTxnID {
29
+ export interface FeeSettingsBase
30
+ extends BaseLedgerEntry,
31
+ HasOptionalPreviousTxnID {
30
32
  LedgerEntryType: 'FeeSettings'
31
33
  /**
32
34
  * A bit-map of boolean flags for this object. No flags are defined for this type.
@@ -1,14 +1,14 @@
1
+ import { APIVersion, DEFAULT_API_VERSION, RIPPLED_API_V1 } from '../common'
1
2
  import { Transaction, TransactionMetadata } from '../transactions'
2
3
 
3
4
  import { LedgerEntry } from './LedgerEntry'
4
5
 
5
6
  /**
6
- * A ledger is a block of transactions and shared state data. It has a unique
7
- * header that describes its contents using cryptographic hashes.
7
+ * Common properties for ledger entries.
8
8
  *
9
9
  * @category Ledger Entries
10
10
  */
11
- export default interface Ledger {
11
+ interface BaseLedger {
12
12
  /** The SHA-512Half of this ledger's state tree information. */
13
13
  account_hash: string
14
14
  /** All the state information in this ledger. Admin only. */
@@ -38,11 +38,6 @@ export default interface Ledger {
38
38
  * for this ledger and all its contents.
39
39
  */
40
40
  ledger_hash: string
41
- /**
42
- * The ledger index of the ledger. Some API methods display this as a quoted
43
- * integer; some display it as a native JSON number.
44
- */
45
- ledger_index: string
46
41
  /** The approximate time at which the previous ledger was closed. */
47
42
  parent_close_time: number
48
43
  /**
@@ -61,5 +56,47 @@ export default interface Ledger {
61
56
  * either JSON or binary depending on whether the request specified binary
62
57
  * as true.
63
58
  */
64
- transactions?: Array<Transaction & { metaData?: TransactionMetadata }>
59
+ transactions?: Array<
60
+ Transaction & {
61
+ hash: string
62
+ metaData?: TransactionMetadata
63
+ }
64
+ >
65
+ }
66
+
67
+ /**
68
+ * A ledger is a block of transactions and shared state data. It has a unique
69
+ * header that describes its contents using cryptographic hashes.
70
+ *
71
+ * @category Ledger Entries
72
+ */
73
+ export interface Ledger extends BaseLedger {
74
+ /**
75
+ * The ledger index of the ledger. Represented as a number.
76
+ */
77
+ ledger_index: number
65
78
  }
79
+
80
+ /**
81
+ * A ledger is a block of transactions and shared state data. It has a unique
82
+ * header that describes its contents using cryptographic hashes. This is used
83
+ * in api_version 1.
84
+ *
85
+ * @category Ledger Entries
86
+ */
87
+ export interface LedgerV1 extends BaseLedger {
88
+ /**
89
+ * The ledger index of the ledger. Some API methods display this as a quoted
90
+ * integer; some display it as a number.
91
+ */
92
+ ledger_index: string
93
+ }
94
+
95
+ /**
96
+ * Type to map between the API version and the Ledger type.
97
+ *
98
+ * @category Responses
99
+ */
100
+ export type LedgerVersionMap<
101
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
102
+ > = Version extends typeof RIPPLED_API_V1 ? LedgerV1 : Ledger
@@ -51,6 +51,8 @@ type LedgerEntryFilter =
51
51
  | 'escrow'
52
52
  | 'fee'
53
53
  | 'hashes'
54
+ | 'mpt_issuance'
55
+ | 'mptoken'
54
56
  | 'nft_offer'
55
57
  | 'nft_page'
56
58
  | 'offer'
@@ -1,4 +1,4 @@
1
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
1
+ import { BaseLedgerEntry } from './BaseLedgerEntry'
2
2
 
3
3
  /**
4
4
  * The LedgerHashes objects exist to make it possible to look up a previous
@@ -7,9 +7,7 @@ import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
7
7
  *
8
8
  * @category Ledger Entries
9
9
  */
10
- export default interface LedgerHashes
11
- extends BaseLedgerEntry,
12
- MissingPreviousTxnID {
10
+ export default interface LedgerHashes extends BaseLedgerEntry {
13
11
  LedgerEntryType: 'LedgerHashes'
14
12
  /** The Ledger Index of the last entry in this object's Hashes array. */
15
13
  LastLedgerSequence?: number
@@ -0,0 +1,12 @@
1
+ import { MPTAmount } from '../common'
2
+
3
+ import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
4
+
5
+ export interface MPToken extends BaseLedgerEntry, HasPreviousTxnID {
6
+ LedgerEntryType: 'MPToken'
7
+ MPTokenIssuanceID: string
8
+ MPTAmount: MPTAmount
9
+ LockedAmount?: MPTAmount
10
+ Flags: number
11
+ OwnerNode?: string
12
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseLedgerEntry, HasPreviousTxnID } from './BaseLedgerEntry'
2
+
3
+ export interface MPTokenIssuance extends BaseLedgerEntry, HasPreviousTxnID {
4
+ LedgerEntryType: 'MPTokenIssuance'
5
+ Flags: number
6
+ Issuer: string
7
+ AssetScale?: number
8
+ MaximumAmount?: string
9
+ OutstandingAmount: string
10
+ LockedAmount?: string
11
+ TransferFee?: number
12
+ MPTokenMetadata?: string
13
+ OwnerNode?: string
14
+ }
@@ -1,4 +1,4 @@
1
- import { BaseLedgerEntry, MissingPreviousTxnID } from './BaseLedgerEntry'
1
+ import { BaseLedgerEntry, HasOptionalPreviousTxnID } from './BaseLedgerEntry'
2
2
 
3
3
  /**
4
4
  * The unique id for the nUNL object https://xrpl.org/negativeunl.html#negativeunl-id-format
@@ -14,7 +14,7 @@ export const NEGATIVE_UNL_ID =
14
14
  */
15
15
  export default interface NegativeUNL
16
16
  extends BaseLedgerEntry,
17
- MissingPreviousTxnID {
17
+ HasOptionalPreviousTxnID {
18
18
  LedgerEntryType: 'NegativeUNL'
19
19
  /**
20
20
  * A list of trusted validators that are currently disabled.
@@ -15,10 +15,12 @@ import FeeSettings, {
15
15
  FeeSettingsPostAmendmentFields,
16
16
  FEE_SETTINGS_ID,
17
17
  } from './FeeSettings'
18
- import Ledger from './Ledger'
18
+ import { Ledger, LedgerV1 } from './Ledger'
19
19
  import { LedgerEntry, LedgerEntryFilter } from './LedgerEntry'
20
20
  import LedgerHashes from './LedgerHashes'
21
21
  import NegativeUNL, { NEGATIVE_UNL_ID } from './NegativeUNL'
22
+ import { MPTokenIssuance } from './MPTokenIssuance'
23
+ import { MPToken } from './MPToken'
22
24
  import { NFTokenOffer } from './NFTokenOffer'
23
25
  import { NFToken, NFTokenPage } from './NFTokenPage'
24
26
  import Offer, { OfferFlags } from './Offer'
@@ -48,12 +50,15 @@ export {
48
50
  FeeSettingsPreAmendmentFields,
49
51
  FeeSettingsPostAmendmentFields,
50
52
  Ledger,
53
+ LedgerV1,
51
54
  LedgerEntryFilter,
52
55
  LedgerEntry,
53
56
  LedgerHashes,
54
57
  Majority,
55
58
  NEGATIVE_UNL_ID,
56
59
  NegativeUNL,
60
+ MPTokenIssuance,
61
+ MPToken,
57
62
  NFTokenOffer,
58
63
  NFTokenPage,
59
64
  NFToken,
@@ -1,3 +1,4 @@
1
+ import { APIVersion, DEFAULT_API_VERSION, RIPPLED_API_V1 } from '../common'
1
2
  import { AccountRoot, SignerList } from '../ledger'
2
3
 
3
4
  import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
@@ -133,23 +134,13 @@ export interface AccountInfoAccountFlags {
133
134
  allowTrustLineClawback: boolean
134
135
  }
135
136
 
136
- /**
137
- * Response expected from an {@link AccountInfoRequest}.
138
- *
139
- * @category Responses
140
- */
141
- export interface AccountInfoResponse extends BaseResponse {
137
+ interface BaseAccountInfoResponse extends BaseResponse {
142
138
  result: {
143
139
  /**
144
140
  * The AccountRoot ledger object with this account's information, as stored
145
141
  * in the ledger.
146
- * If requested, also includes Array of SignerList ledger objects
147
- * associated with this account for Multi-Signing. Since an account can own
148
- * at most one SignerList, this array must have exactly one member if it is
149
- * present.
150
142
  */
151
- account_data: AccountRoot & { signer_lists?: SignerList[] }
152
-
143
+ account_data: AccountRoot
153
144
  /**
154
145
  * A map of account flags parsed out. This will only be available for rippled nodes 1.11.0 and higher.
155
146
  */
@@ -180,3 +171,58 @@ export interface AccountInfoResponse extends BaseResponse {
180
171
  validated?: boolean
181
172
  }
182
173
  }
174
+
175
+ /**
176
+ * Response expected from a {@link AccountInfoRequest}.
177
+ *
178
+ * @category Responses
179
+ */
180
+ export interface AccountInfoResponse extends BaseAccountInfoResponse {
181
+ result: BaseAccountInfoResponse['result'] & {
182
+ /**
183
+ * If requested, array of SignerList ledger objects associated with this account for Multi-Signing.
184
+ * Since an account can own at most one SignerList, this array must have exactly one
185
+ * member if it is present.
186
+ */
187
+ signer_lists?: SignerList[]
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Response expected from a {@link AccountInfoRequest} using API version 1.
193
+ *
194
+ * @category ResponsesV1
195
+ */
196
+ export interface AccountInfoV1Response extends BaseAccountInfoResponse {
197
+ result: BaseAccountInfoResponse['result'] & {
198
+ /**
199
+ * The AccountRoot ledger object with this account's information, as stored
200
+ * in the ledger.
201
+ * If requested, also includes Array of SignerList ledger objects
202
+ * associated with this account for Multi-Signing. Since an account can own
203
+ * at most one SignerList, this array must have exactly one member if it is
204
+ * present.
205
+ */
206
+ account_data: BaseAccountInfoResponse['result']['account_data'] & {
207
+ /**
208
+ * Array of SignerList ledger objects associated with this account for Multi-Signing.
209
+ * Since an account can own at most one SignerList, this array must have exactly one
210
+ * member if it is present.
211
+ * Quirk: In API version 1, this field is nested under account_data. For this method,
212
+ * Clio implements the API version 2 behavior where is field is not nested under account_data.
213
+ */
214
+ signer_lists?: SignerList[]
215
+ }
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Type to map between the API version and the response type.
221
+ *
222
+ * @category Responses
223
+ */
224
+ export type AccountInfoVersionResponseMap<
225
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
226
+ > = Version extends typeof RIPPLED_API_V1
227
+ ? AccountInfoV1Response
228
+ : AccountInfoResponse
@@ -1,4 +1,10 @@
1
- import { ResponseOnlyTxInfo } from '../common'
1
+ import {
2
+ APIVersion,
3
+ DEFAULT_API_VERSION,
4
+ RIPPLED_API_V1,
5
+ RIPPLED_API_V2,
6
+ ResponseOnlyTxInfo,
7
+ } from '../common'
2
8
  import { Transaction, TransactionMetadata } from '../transactions'
3
9
 
4
10
  import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
@@ -49,7 +55,9 @@ export interface AccountTxRequest extends BaseRequest, LookupByLedgerRequest {
49
55
  marker?: unknown
50
56
  }
51
57
 
52
- export interface AccountTxTransaction {
58
+ export interface AccountTxTransaction<
59
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
60
+ > {
53
61
  /** The ledger index of the ledger version that included this transaction. */
54
62
  ledger_index: number
55
63
  /**
@@ -58,7 +66,15 @@ export interface AccountTxTransaction {
58
66
  */
59
67
  meta: string | TransactionMetadata
60
68
  /** JSON object defining the transaction. */
61
- tx?: Transaction & ResponseOnlyTxInfo
69
+ tx_json?: Version extends typeof RIPPLED_API_V2
70
+ ? Transaction & ResponseOnlyTxInfo
71
+ : never
72
+ /** JSON object defining the transaction in rippled API v1. */
73
+ tx?: Version extends typeof RIPPLED_API_V1
74
+ ? Transaction & ResponseOnlyTxInfo
75
+ : never
76
+ /** The hash of the transaction. */
77
+ hash?: Version extends typeof RIPPLED_API_V2 ? string : never
62
78
  /** Unique hashed String representing the transaction. */
63
79
  tx_blob?: string
64
80
  /**
@@ -69,11 +85,11 @@ export interface AccountTxTransaction {
69
85
  }
70
86
 
71
87
  /**
72
- * Expected response from an {@link AccountTxRequest}.
73
- *
74
- * @category Responses
88
+ * Base interface for account transaction responses.
75
89
  */
76
- export interface AccountTxResponse extends BaseResponse {
90
+ interface AccountTxResponseBase<
91
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
92
+ > extends BaseResponse {
77
93
  result: {
78
94
  /** Unique Address identifying the related account. */
79
95
  account: string
@@ -98,7 +114,7 @@ export interface AccountTxResponse extends BaseResponse {
98
114
  * Array of transactions matching the request's criteria, as explained
99
115
  * below.
100
116
  */
101
- transactions: AccountTxTransaction[]
117
+ transactions: Array<AccountTxTransaction<Version>>
102
118
  /**
103
119
  * If included and set to true, the information in this response comes from
104
120
  * a validated ledger version. Otherwise, the information is subject to
@@ -107,3 +123,28 @@ export interface AccountTxResponse extends BaseResponse {
107
123
  validated?: boolean
108
124
  }
109
125
  }
126
+
127
+ /**
128
+ * Expected response from an {@link AccountTxRequest}.
129
+ *
130
+ * @category Responses
131
+ */
132
+ export type AccountTxResponse = AccountTxResponseBase
133
+
134
+ /**
135
+ * Expected response from an {@link AccountTxRequest} with `api_version` set to 1.
136
+ *
137
+ * @category ResponsesV1
138
+ */
139
+ export type AccountTxV1Response = AccountTxResponseBase<typeof RIPPLED_API_V1>
140
+
141
+ /**
142
+ * Type to map between the API version and the response type.
143
+ *
144
+ * @category Responses
145
+ */
146
+ export type AccountTxVersionResponseMap<
147
+ Version extends APIVersion = typeof DEFAULT_API_VERSION,
148
+ > = Version extends typeof RIPPLED_API_V1
149
+ ? AccountTxV1Response
150
+ : AccountTxResponse