xrpl 4.3.0 → 4.4.0-smartescrow.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 (310) hide show
  1. package/build/xrpl-latest-min.js +1 -1
  2. package/build/xrpl-latest-min.js.map +1 -1
  3. package/build/xrpl-latest.js +1293 -1596
  4. package/build/xrpl-latest.js.map +1 -1
  5. package/dist/npm/Wallet/defaultFaucets.d.ts +2 -1
  6. package/dist/npm/Wallet/defaultFaucets.d.ts.map +1 -1
  7. package/dist/npm/Wallet/defaultFaucets.js +3 -0
  8. package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
  9. package/dist/npm/client/index.d.ts +3 -3
  10. package/dist/npm/client/index.d.ts.map +1 -1
  11. package/dist/npm/client/index.js +10 -7
  12. package/dist/npm/client/index.js.map +1 -1
  13. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  14. package/dist/npm/client/partialPayment.js +2 -2
  15. package/dist/npm/client/partialPayment.js.map +1 -1
  16. package/dist/npm/models/common/index.d.ts +1 -0
  17. package/dist/npm/models/common/index.d.ts.map +1 -1
  18. package/dist/npm/models/ledger/AccountRoot.d.ts +1 -1
  19. package/dist/npm/models/ledger/AccountRoot.d.ts.map +1 -1
  20. package/dist/npm/models/ledger/Escrow.d.ts +2 -0
  21. package/dist/npm/models/ledger/Escrow.d.ts.map +1 -1
  22. package/dist/npm/models/ledger/FeeSettings.d.ts +2 -0
  23. package/dist/npm/models/ledger/FeeSettings.d.ts.map +1 -1
  24. package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
  25. package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
  26. package/dist/npm/models/ledger/Vault.d.ts +21 -0
  27. package/dist/npm/models/ledger/Vault.d.ts.map +1 -0
  28. package/dist/npm/models/ledger/Vault.js +3 -0
  29. package/dist/npm/models/ledger/Vault.js.map +1 -0
  30. package/dist/npm/models/ledger/index.d.ts +2 -1
  31. package/dist/npm/models/ledger/index.d.ts.map +1 -1
  32. package/dist/npm/models/ledger/index.js.map +1 -1
  33. package/dist/npm/models/methods/index.d.ts +5 -4
  34. package/dist/npm/models/methods/index.d.ts.map +1 -1
  35. package/dist/npm/models/methods/serverInfo.d.ts +6 -0
  36. package/dist/npm/models/methods/serverInfo.d.ts.map +1 -1
  37. package/dist/npm/models/methods/serverState.d.ts +6 -0
  38. package/dist/npm/models/methods/serverState.d.ts.map +1 -1
  39. package/dist/npm/models/methods/vaultInfo.d.ts +46 -0
  40. package/dist/npm/models/methods/vaultInfo.d.ts.map +1 -0
  41. package/dist/npm/models/methods/vaultInfo.js +3 -0
  42. package/dist/npm/models/methods/vaultInfo.js.map +1 -0
  43. package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -1
  44. package/dist/npm/models/transactions/AMMBid.js +7 -5
  45. package/dist/npm/models/transactions/AMMBid.js.map +1 -1
  46. package/dist/npm/models/transactions/AMMClawback.d.ts.map +1 -1
  47. package/dist/npm/models/transactions/AMMClawback.js +5 -6
  48. package/dist/npm/models/transactions/AMMClawback.js.map +1 -1
  49. package/dist/npm/models/transactions/AMMDelete.d.ts.map +1 -1
  50. package/dist/npm/models/transactions/AMMDelete.js +2 -2
  51. package/dist/npm/models/transactions/AMMDelete.js.map +1 -1
  52. package/dist/npm/models/transactions/AMMDeposit.js +3 -3
  53. package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
  54. package/dist/npm/models/transactions/AMMVote.d.ts.map +1 -1
  55. package/dist/npm/models/transactions/AMMVote.js +2 -2
  56. package/dist/npm/models/transactions/AMMVote.js.map +1 -1
  57. package/dist/npm/models/transactions/AMMWithdraw.js +3 -3
  58. package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
  59. package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  60. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +3 -3
  61. package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  62. package/dist/npm/models/transactions/MPTokenIssuanceSet.js +4 -4
  63. package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
  64. package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  65. package/dist/npm/models/transactions/NFTokenCancelOffer.js +1 -1
  66. package/dist/npm/models/transactions/NFTokenCancelOffer.js.map +1 -1
  67. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  68. package/dist/npm/models/transactions/NFTokenCreateOffer.js +6 -2
  69. package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
  70. package/dist/npm/models/transactions/checkCreate.d.ts.map +1 -1
  71. package/dist/npm/models/transactions/checkCreate.js +1 -2
  72. package/dist/npm/models/transactions/checkCreate.js.map +1 -1
  73. package/dist/npm/models/transactions/clawback.d.ts +2 -2
  74. package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
  75. package/dist/npm/models/transactions/clawback.js +4 -6
  76. package/dist/npm/models/transactions/clawback.js.map +1 -1
  77. package/dist/npm/models/transactions/common.d.ts +9 -4
  78. package/dist/npm/models/transactions/common.d.ts.map +1 -1
  79. package/dist/npm/models/transactions/common.js +51 -28
  80. package/dist/npm/models/transactions/common.js.map +1 -1
  81. package/dist/npm/models/transactions/escrowCreate.d.ts +2 -0
  82. package/dist/npm/models/transactions/escrowCreate.d.ts.map +1 -1
  83. package/dist/npm/models/transactions/escrowCreate.js +4 -2
  84. package/dist/npm/models/transactions/escrowCreate.js.map +1 -1
  85. package/dist/npm/models/transactions/escrowFinish.d.ts +1 -0
  86. package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
  87. package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
  88. package/dist/npm/models/transactions/index.d.ts +8 -2
  89. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  90. package/dist/npm/models/transactions/index.js +4 -1
  91. package/dist/npm/models/transactions/index.js.map +1 -1
  92. package/dist/npm/models/transactions/oracleSet.d.ts.map +1 -1
  93. package/dist/npm/models/transactions/oracleSet.js +22 -21
  94. package/dist/npm/models/transactions/oracleSet.js.map +1 -1
  95. package/dist/npm/models/transactions/payment.d.ts +1 -0
  96. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  97. package/dist/npm/models/transactions/payment.js +6 -4
  98. package/dist/npm/models/transactions/payment.js.map +1 -1
  99. package/dist/npm/models/transactions/signerListSet.d.ts.map +1 -1
  100. package/dist/npm/models/transactions/signerListSet.js +10 -16
  101. package/dist/npm/models/transactions/signerListSet.js.map +1 -1
  102. package/dist/npm/models/transactions/transaction.d.ts +7 -1
  103. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  104. package/dist/npm/models/transactions/transaction.js +28 -35
  105. package/dist/npm/models/transactions/transaction.js.map +1 -1
  106. package/dist/npm/models/transactions/vaultClawback.d.ts +10 -0
  107. package/dist/npm/models/transactions/vaultClawback.d.ts.map +1 -0
  108. package/dist/npm/models/transactions/vaultClawback.js +12 -0
  109. package/dist/npm/models/transactions/vaultClawback.js.map +1 -0
  110. package/dist/npm/models/transactions/vaultCreate.d.ts +24 -0
  111. package/dist/npm/models/transactions/vaultCreate.d.ts.map +1 -0
  112. package/dist/npm/models/transactions/vaultCreate.js +51 -0
  113. package/dist/npm/models/transactions/vaultCreate.js.map +1 -0
  114. package/dist/npm/models/transactions/vaultDelete.d.ts +7 -0
  115. package/dist/npm/models/transactions/vaultDelete.d.ts.map +1 -0
  116. package/dist/npm/models/transactions/vaultDelete.js +10 -0
  117. package/dist/npm/models/transactions/vaultDelete.js.map +1 -0
  118. package/dist/npm/models/transactions/vaultDeposit.d.ts +9 -0
  119. package/dist/npm/models/transactions/vaultDeposit.d.ts.map +1 -0
  120. package/dist/npm/models/transactions/vaultDeposit.js +11 -0
  121. package/dist/npm/models/transactions/vaultDeposit.js.map +1 -0
  122. package/dist/npm/models/transactions/vaultSet.d.ts +10 -0
  123. package/dist/npm/models/transactions/vaultSet.d.ts.map +1 -0
  124. package/dist/npm/models/transactions/vaultSet.js +25 -0
  125. package/dist/npm/models/transactions/vaultSet.js.map +1 -0
  126. package/dist/npm/models/transactions/vaultWithdraw.d.ts +10 -0
  127. package/dist/npm/models/transactions/vaultWithdraw.d.ts.map +1 -0
  128. package/dist/npm/models/transactions/vaultWithdraw.js +12 -0
  129. package/dist/npm/models/transactions/vaultWithdraw.js.map +1 -0
  130. package/dist/npm/models/utils/flags.d.ts.map +1 -1
  131. package/dist/npm/models/utils/flags.js +2 -0
  132. package/dist/npm/models/utils/flags.js.map +1 -1
  133. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  134. package/dist/npm/src/Wallet/defaultFaucets.d.ts +2 -1
  135. package/dist/npm/src/Wallet/defaultFaucets.d.ts.map +1 -1
  136. package/dist/npm/src/Wallet/defaultFaucets.js +3 -0
  137. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  138. package/dist/npm/src/client/index.d.ts +3 -3
  139. package/dist/npm/src/client/index.d.ts.map +1 -1
  140. package/dist/npm/src/client/index.js +10 -7
  141. package/dist/npm/src/client/index.js.map +1 -1
  142. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  143. package/dist/npm/src/client/partialPayment.js +2 -2
  144. package/dist/npm/src/client/partialPayment.js.map +1 -1
  145. package/dist/npm/src/models/common/index.d.ts +1 -0
  146. package/dist/npm/src/models/common/index.d.ts.map +1 -1
  147. package/dist/npm/src/models/ledger/AccountRoot.d.ts +1 -1
  148. package/dist/npm/src/models/ledger/AccountRoot.d.ts.map +1 -1
  149. package/dist/npm/src/models/ledger/Escrow.d.ts +2 -0
  150. package/dist/npm/src/models/ledger/Escrow.d.ts.map +1 -1
  151. package/dist/npm/src/models/ledger/FeeSettings.d.ts +2 -0
  152. package/dist/npm/src/models/ledger/FeeSettings.d.ts.map +1 -1
  153. package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
  154. package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
  155. package/dist/npm/src/models/ledger/Vault.d.ts +21 -0
  156. package/dist/npm/src/models/ledger/Vault.d.ts.map +1 -0
  157. package/dist/npm/src/models/ledger/Vault.js +3 -0
  158. package/dist/npm/src/models/ledger/Vault.js.map +1 -0
  159. package/dist/npm/src/models/ledger/index.d.ts +2 -1
  160. package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
  161. package/dist/npm/src/models/ledger/index.js.map +1 -1
  162. package/dist/npm/src/models/methods/index.d.ts +5 -4
  163. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  164. package/dist/npm/src/models/methods/serverInfo.d.ts +6 -0
  165. package/dist/npm/src/models/methods/serverInfo.d.ts.map +1 -1
  166. package/dist/npm/src/models/methods/serverState.d.ts +6 -0
  167. package/dist/npm/src/models/methods/serverState.d.ts.map +1 -1
  168. package/dist/npm/src/models/methods/vaultInfo.d.ts +46 -0
  169. package/dist/npm/src/models/methods/vaultInfo.d.ts.map +1 -0
  170. package/dist/npm/src/models/methods/vaultInfo.js +3 -0
  171. package/dist/npm/src/models/methods/vaultInfo.js.map +1 -0
  172. package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -1
  173. package/dist/npm/src/models/transactions/AMMBid.js +7 -5
  174. package/dist/npm/src/models/transactions/AMMBid.js.map +1 -1
  175. package/dist/npm/src/models/transactions/AMMClawback.d.ts.map +1 -1
  176. package/dist/npm/src/models/transactions/AMMClawback.js +5 -6
  177. package/dist/npm/src/models/transactions/AMMClawback.js.map +1 -1
  178. package/dist/npm/src/models/transactions/AMMDelete.d.ts.map +1 -1
  179. package/dist/npm/src/models/transactions/AMMDelete.js +2 -2
  180. package/dist/npm/src/models/transactions/AMMDelete.js.map +1 -1
  181. package/dist/npm/src/models/transactions/AMMDeposit.js +3 -3
  182. package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
  183. package/dist/npm/src/models/transactions/AMMVote.d.ts.map +1 -1
  184. package/dist/npm/src/models/transactions/AMMVote.js +2 -2
  185. package/dist/npm/src/models/transactions/AMMVote.js.map +1 -1
  186. package/dist/npm/src/models/transactions/AMMWithdraw.js +3 -3
  187. package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
  188. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
  189. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +3 -3
  190. package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
  191. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +4 -4
  192. package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -1
  193. package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  194. package/dist/npm/src/models/transactions/NFTokenCancelOffer.js +1 -1
  195. package/dist/npm/src/models/transactions/NFTokenCancelOffer.js.map +1 -1
  196. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  197. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js +6 -2
  198. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js.map +1 -1
  199. package/dist/npm/src/models/transactions/checkCreate.d.ts.map +1 -1
  200. package/dist/npm/src/models/transactions/checkCreate.js +1 -2
  201. package/dist/npm/src/models/transactions/checkCreate.js.map +1 -1
  202. package/dist/npm/src/models/transactions/clawback.d.ts +2 -2
  203. package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
  204. package/dist/npm/src/models/transactions/clawback.js +4 -6
  205. package/dist/npm/src/models/transactions/clawback.js.map +1 -1
  206. package/dist/npm/src/models/transactions/common.d.ts +9 -4
  207. package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
  208. package/dist/npm/src/models/transactions/common.js +51 -28
  209. package/dist/npm/src/models/transactions/common.js.map +1 -1
  210. package/dist/npm/src/models/transactions/escrowCreate.d.ts +2 -0
  211. package/dist/npm/src/models/transactions/escrowCreate.d.ts.map +1 -1
  212. package/dist/npm/src/models/transactions/escrowCreate.js +4 -2
  213. package/dist/npm/src/models/transactions/escrowCreate.js.map +1 -1
  214. package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -0
  215. package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
  216. package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
  217. package/dist/npm/src/models/transactions/index.d.ts +8 -2
  218. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  219. package/dist/npm/src/models/transactions/index.js +4 -1
  220. package/dist/npm/src/models/transactions/index.js.map +1 -1
  221. package/dist/npm/src/models/transactions/oracleSet.d.ts.map +1 -1
  222. package/dist/npm/src/models/transactions/oracleSet.js +22 -21
  223. package/dist/npm/src/models/transactions/oracleSet.js.map +1 -1
  224. package/dist/npm/src/models/transactions/payment.d.ts +1 -0
  225. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  226. package/dist/npm/src/models/transactions/payment.js +6 -4
  227. package/dist/npm/src/models/transactions/payment.js.map +1 -1
  228. package/dist/npm/src/models/transactions/signerListSet.d.ts.map +1 -1
  229. package/dist/npm/src/models/transactions/signerListSet.js +10 -16
  230. package/dist/npm/src/models/transactions/signerListSet.js.map +1 -1
  231. package/dist/npm/src/models/transactions/transaction.d.ts +7 -1
  232. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  233. package/dist/npm/src/models/transactions/transaction.js +28 -35
  234. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  235. package/dist/npm/src/models/transactions/vaultClawback.d.ts +10 -0
  236. package/dist/npm/src/models/transactions/vaultClawback.d.ts.map +1 -0
  237. package/dist/npm/src/models/transactions/vaultClawback.js +12 -0
  238. package/dist/npm/src/models/transactions/vaultClawback.js.map +1 -0
  239. package/dist/npm/src/models/transactions/vaultCreate.d.ts +24 -0
  240. package/dist/npm/src/models/transactions/vaultCreate.d.ts.map +1 -0
  241. package/dist/npm/src/models/transactions/vaultCreate.js +51 -0
  242. package/dist/npm/src/models/transactions/vaultCreate.js.map +1 -0
  243. package/dist/npm/src/models/transactions/vaultDelete.d.ts +7 -0
  244. package/dist/npm/src/models/transactions/vaultDelete.d.ts.map +1 -0
  245. package/dist/npm/src/models/transactions/vaultDelete.js +10 -0
  246. package/dist/npm/src/models/transactions/vaultDelete.js.map +1 -0
  247. package/dist/npm/src/models/transactions/vaultDeposit.d.ts +9 -0
  248. package/dist/npm/src/models/transactions/vaultDeposit.d.ts.map +1 -0
  249. package/dist/npm/src/models/transactions/vaultDeposit.js +11 -0
  250. package/dist/npm/src/models/transactions/vaultDeposit.js.map +1 -0
  251. package/dist/npm/src/models/transactions/vaultSet.d.ts +10 -0
  252. package/dist/npm/src/models/transactions/vaultSet.d.ts.map +1 -0
  253. package/dist/npm/src/models/transactions/vaultSet.js +25 -0
  254. package/dist/npm/src/models/transactions/vaultSet.js.map +1 -0
  255. package/dist/npm/src/models/transactions/vaultWithdraw.d.ts +10 -0
  256. package/dist/npm/src/models/transactions/vaultWithdraw.d.ts.map +1 -0
  257. package/dist/npm/src/models/transactions/vaultWithdraw.js +12 -0
  258. package/dist/npm/src/models/transactions/vaultWithdraw.js.map +1 -0
  259. package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
  260. package/dist/npm/src/models/utils/flags.js +2 -0
  261. package/dist/npm/src/models/utils/flags.js.map +1 -1
  262. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  263. package/dist/npm/src/sugar/autofill.js +32 -11
  264. package/dist/npm/src/sugar/autofill.js.map +1 -1
  265. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  266. package/dist/npm/sugar/autofill.js +32 -11
  267. package/dist/npm/sugar/autofill.js.map +1 -1
  268. package/package.json +5 -4
  269. package/src/Wallet/defaultFaucets.ts +5 -0
  270. package/src/client/index.ts +43 -38
  271. package/src/client/partialPayment.ts +1 -2
  272. package/src/models/common/index.ts +2 -0
  273. package/src/models/ledger/AccountRoot.ts +1 -1
  274. package/src/models/ledger/Escrow.ts +4 -0
  275. package/src/models/ledger/FeeSettings.ts +4 -0
  276. package/src/models/ledger/LedgerEntry.ts +3 -0
  277. package/src/models/ledger/Vault.ts +83 -0
  278. package/src/models/ledger/index.ts +3 -1
  279. package/src/models/methods/index.ts +10 -0
  280. package/src/models/methods/serverInfo.ts +9 -0
  281. package/src/models/methods/serverState.ts +10 -0
  282. package/src/models/methods/vaultInfo.ts +193 -0
  283. package/src/models/transactions/AMMBid.ts +12 -20
  284. package/src/models/transactions/AMMClawback.ts +8 -11
  285. package/src/models/transactions/AMMDelete.ts +7 -3
  286. package/src/models/transactions/AMMDeposit.ts +4 -4
  287. package/src/models/transactions/AMMVote.ts +7 -3
  288. package/src/models/transactions/AMMWithdraw.ts +4 -4
  289. package/src/models/transactions/MPTokenIssuanceCreate.ts +3 -1
  290. package/src/models/transactions/MPTokenIssuanceSet.ts +1 -1
  291. package/src/models/transactions/NFTokenCancelOffer.ts +2 -2
  292. package/src/models/transactions/NFTokenCreateOffer.ts +8 -4
  293. package/src/models/transactions/checkCreate.ts +2 -6
  294. package/src/models/transactions/clawback.ts +9 -10
  295. package/src/models/transactions/common.ts +114 -41
  296. package/src/models/transactions/escrowCreate.ts +10 -2
  297. package/src/models/transactions/escrowFinish.ts +2 -0
  298. package/src/models/transactions/index.ts +13 -2
  299. package/src/models/transactions/oracleSet.ts +32 -39
  300. package/src/models/transactions/payment.ts +13 -7
  301. package/src/models/transactions/signerListSet.ts +21 -21
  302. package/src/models/transactions/transaction.ts +46 -43
  303. package/src/models/transactions/vaultClawback.ts +55 -0
  304. package/src/models/transactions/vaultCreate.ts +142 -0
  305. package/src/models/transactions/vaultDelete.ts +32 -0
  306. package/src/models/transactions/vaultDeposit.ts +41 -0
  307. package/src/models/transactions/vaultSet.ts +71 -0
  308. package/src/models/transactions/vaultWithdraw.ts +50 -0
  309. package/src/models/utils/flags.ts +2 -0
  310. package/src/sugar/autofill.ts +44 -31
@@ -7,31 +7,42 @@ import { ValidationError } from '../../errors'
7
7
  import {
8
8
  Amount,
9
9
  AuthorizeCredential,
10
+ ClawbackAmount,
10
11
  Currency,
12
+ IssuedCurrency,
11
13
  IssuedCurrencyAmount,
12
14
  MPTAmount,
13
15
  Memo,
14
16
  Signer,
15
17
  XChainBridge,
16
18
  } from '../common'
17
- import { onlyHasFields } from '../utils'
19
+ import { isHex, onlyHasFields } from '../utils'
18
20
 
19
21
  const MEMO_SIZE = 3
20
22
  export const MAX_AUTHORIZED_CREDENTIALS = 8
21
23
  const MAX_CREDENTIAL_BYTE_LENGTH = 64
22
24
  const MAX_CREDENTIAL_TYPE_LENGTH = MAX_CREDENTIAL_BYTE_LENGTH * 2
23
25
 
24
- function isMemo(obj: { Memo?: unknown }): boolean {
25
- if (obj.Memo == null) {
26
+ // Used for Vault transactions
27
+ export const VAULT_DATA_MAX_BYTE_LENGTH = 256
28
+
29
+ function isMemo(obj: unknown): obj is Memo {
30
+ if (!isRecord(obj)) {
31
+ return false
32
+ }
33
+
34
+ const memo = obj.Memo
35
+ if (!isRecord(memo)) {
26
36
  return false
27
37
  }
28
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
29
- const memo = obj.Memo as Record<string, unknown>
30
38
  const size = Object.keys(memo).length
31
- const validData = memo.MemoData == null || typeof memo.MemoData === 'string'
39
+ const validData =
40
+ memo.MemoData == null || (isString(memo.MemoData) && isHex(memo.MemoData))
32
41
  const validFormat =
33
- memo.MemoFormat == null || typeof memo.MemoFormat === 'string'
34
- const validType = memo.MemoType == null || typeof memo.MemoType === 'string'
42
+ memo.MemoFormat == null ||
43
+ (isString(memo.MemoFormat) && isHex(memo.MemoFormat))
44
+ const validType =
45
+ memo.MemoType == null || (isString(memo.MemoType) && isHex(memo.MemoType))
35
46
 
36
47
  return (
37
48
  size >= 1 &&
@@ -45,20 +56,21 @@ function isMemo(obj: { Memo?: unknown }): boolean {
45
56
 
46
57
  const SIGNER_SIZE = 3
47
58
 
48
- function isSigner(obj: unknown): boolean {
49
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
50
- const signerWrapper = obj as Record<string, unknown>
59
+ function isSigner(obj: unknown): obj is Signer {
60
+ if (!isRecord(obj)) {
61
+ return false
62
+ }
51
63
 
52
- if (signerWrapper.Signer == null) {
64
+ const signer = obj.Signer
65
+ if (!isRecord(signer)) {
53
66
  return false
54
67
  }
55
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS and Signer is previously unknown
56
- const signer = signerWrapper.Signer as Record<string, unknown>
68
+
57
69
  return (
58
70
  Object.keys(signer).length === SIGNER_SIZE &&
59
- typeof signer.Account === 'string' &&
60
- typeof signer.TxnSignature === 'string' &&
61
- typeof signer.SigningPubKey === 'string'
71
+ isString(signer.Account) &&
72
+ isString(signer.TxnSignature) &&
73
+ isString(signer.SigningPubKey)
62
74
  )
63
75
  }
64
76
 
@@ -76,7 +88,7 @@ const AUTHORIZE_CREDENTIAL_SIZE = 1
76
88
  * @returns Whether the Record/Object is properly formed.
77
89
  */
78
90
  export function isRecord(value: unknown): value is Record<string, unknown> {
79
- return value !== null && typeof value === 'object'
91
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
80
92
  }
81
93
 
82
94
  /**
@@ -99,18 +111,50 @@ export function isNumber(num: unknown): num is number {
99
111
  return typeof num === 'number'
100
112
  }
101
113
 
114
+ /**
115
+ * Checks whether the given value is a valid XRPL number string.
116
+ * Accepts integer, decimal, or scientific notation strings.
117
+ *
118
+ * Examples of valid input:
119
+ * - "123"
120
+ * - "-987.654"
121
+ * - "+3.14e10"
122
+ * - "-7.2e-9"
123
+ *
124
+ * @param value - The value to check.
125
+ * @returns True if value is a string that matches the XRPL number format, false otherwise.
126
+ */
127
+ export function isXRPLNumber(value: unknown): value is XRPLNumber {
128
+ // Matches optional sign, digits, optional decimal, optional exponent (scientific)
129
+ // Allows leading zeros, but not empty string, lone sign, or missing digits
130
+ return (
131
+ typeof value === 'string' &&
132
+ /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/u.test(value.trim())
133
+ )
134
+ }
135
+
136
+ /**
137
+ * Verify the form and type of a Currency at runtime.
138
+ *
139
+ * @param input - The input to check the form and type of.
140
+ * @returns Whether the Currency is properly formed.
141
+ */
142
+ export function isCurrency(input: unknown): input is Currency {
143
+ return isString(input) || isIssuedCurrency(input)
144
+ }
145
+
102
146
  /**
103
147
  * Verify the form and type of an IssuedCurrency at runtime.
104
148
  *
105
149
  * @param input - The input to check the form and type of.
106
150
  * @returns Whether the IssuedCurrency is properly formed.
107
151
  */
108
- export function isCurrency(input: unknown): input is Currency {
152
+ export function isIssuedCurrency(input: unknown): input is IssuedCurrency {
109
153
  return (
110
154
  isRecord(input) &&
111
155
  ((Object.keys(input).length === ISSUE_SIZE &&
112
- typeof input.issuer === 'string' &&
113
- typeof input.currency === 'string') ||
156
+ isString(input.issuer) &&
157
+ isString(input.currency)) ||
114
158
  (Object.keys(input).length === XRP_CURRENCY_SIZE &&
115
159
  input.currency === 'XRP'))
116
160
  )
@@ -122,15 +166,15 @@ export function isCurrency(input: unknown): input is Currency {
122
166
  * @param input - The input to check the form and type of.
123
167
  * @returns Whether the IssuedCurrencyAmount is properly formed.
124
168
  */
125
- export function isIssuedCurrency(
169
+ export function isIssuedCurrencyAmount(
126
170
  input: unknown,
127
171
  ): input is IssuedCurrencyAmount {
128
172
  return (
129
173
  isRecord(input) &&
130
174
  Object.keys(input).length === ISSUED_CURRENCY_SIZE &&
131
- typeof input.value === 'string' &&
132
- typeof input.issuer === 'string' &&
133
- typeof input.currency === 'string'
175
+ isString(input.value) &&
176
+ isString(input.issuer) &&
177
+ isString(input.currency)
134
178
  )
135
179
  }
136
180
 
@@ -167,11 +211,33 @@ export function isMPTAmount(input: unknown): input is MPTAmount {
167
211
  )
168
212
  }
169
213
 
214
+ /**
215
+ * Type guard to verify if the input is a valid ClawbackAmount.
216
+ *
217
+ * A ClawbackAmount can be either an {@link IssuedCurrencyAmount} or an {@link MPTAmount}.
218
+ * This function checks if the input matches either type.
219
+ *
220
+ * @param input - The value to check for ClawbackAmount structure.
221
+ * @returns True if the input is an IssuedCurrencyAmount or MPTAmount, otherwise false.
222
+ */
223
+ export function isClawbackAmount(input: unknown): input is ClawbackAmount {
224
+ return isIssuedCurrencyAmount(input) || isMPTAmount(input)
225
+ }
226
+
170
227
  /**
171
228
  * Must be a valid account address
172
229
  */
173
230
  export type Account = string
174
231
 
232
+ /**
233
+ * XRPL Number type represented as a string.
234
+ *
235
+ * This string can be an integer (e.g., "123"), a decimal (e.g., "123.45"),
236
+ * or in scientific notation (e.g., "1.23e5", "-4.56e-7").
237
+ * Used for fields that accept arbitrary-precision numbers in XRPL transactions and ledger objects.
238
+ */
239
+ export type XRPLNumber = string
240
+
175
241
  /**
176
242
  * Verify a string is in fact a valid account address.
177
243
  *
@@ -194,7 +260,7 @@ export function isAccount(account: unknown): account is Account {
194
260
  export function isAmount(amount: unknown): amount is Amount {
195
261
  return (
196
262
  typeof amount === 'string' ||
197
- isIssuedCurrency(amount) ||
263
+ isIssuedCurrencyAmount(amount) ||
198
264
  isMPTAmount(amount)
199
265
  )
200
266
  }
@@ -210,9 +276,9 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
210
276
  isRecord(input) &&
211
277
  Object.keys(input).length === XCHAIN_BRIDGE_SIZE &&
212
278
  typeof input.LockingChainDoor === 'string' &&
213
- isCurrency(input.LockingChainIssue) &&
279
+ isIssuedCurrency(input.LockingChainIssue) &&
214
280
  typeof input.IssuingChainDoor === 'string' &&
215
- isCurrency(input.IssuingChainIssue)
281
+ isIssuedCurrency(input.IssuingChainIssue)
216
282
  )
217
283
  }
218
284
 
@@ -223,7 +289,7 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
223
289
  * @returns Whether the Array is properly formed.
224
290
  */
225
291
  export function isArray<T = unknown>(input: unknown): input is T[] {
226
- return Array.isArray(input)
292
+ return input != null && Array.isArray(input)
227
293
  }
228
294
 
229
295
  /* eslint-disable @typescript-eslint/restrict-template-expressions -- tx.TransactionType is checked before any calls */
@@ -402,8 +468,14 @@ export interface BaseTransaction extends Record<string, unknown> {
402
468
  */
403
469
  // eslint-disable-next-line max-statements, max-lines-per-function -- lines required for validation
404
470
  export function validateBaseTransaction(
405
- common: Record<string, unknown>,
471
+ common: unknown,
406
472
  ): asserts common is BaseTransaction {
473
+ if (!isRecord(common)) {
474
+ throw new ValidationError(
475
+ 'BaseTransaction: invalid, expected a valid object',
476
+ )
477
+ }
478
+
407
479
  if (common.TransactionType === undefined) {
408
480
  throw new ValidationError('BaseTransaction: missing field TransactionType')
409
481
  }
@@ -428,18 +500,16 @@ export function validateBaseTransaction(
428
500
 
429
501
  validateOptionalField(common, 'LastLedgerSequence', isNumber)
430
502
 
431
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
432
- const memos = common.Memos as Array<{ Memo?: unknown }> | undefined
433
- if (memos !== undefined && !memos.every(isMemo)) {
503
+ const memos = common.Memos
504
+ if (memos != null && (!isArray(memos) || !memos.every(isMemo))) {
434
505
  throw new ValidationError('BaseTransaction: invalid Memos')
435
506
  }
436
507
 
437
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
438
- const signers = common.Signers as Array<Record<string, unknown>> | undefined
508
+ const signers = common.Signers
439
509
 
440
510
  if (
441
- signers !== undefined &&
442
- (signers.length === 0 || !signers.every(isSigner))
511
+ signers != null &&
512
+ (!isArray(signers) || signers.length === 0 || !signers.every(isSigner))
443
513
  ) {
444
514
  throw new ValidationError('BaseTransaction: invalid Signers')
445
515
  }
@@ -486,7 +556,9 @@ export function parseAmountValue(amount: unknown): number {
486
556
  * @param tx A CredentialType Transaction.
487
557
  * @throws when the CredentialType is malformed.
488
558
  */
489
- export function validateCredentialType(tx: Record<string, unknown>): void {
559
+ export function validateCredentialType<
560
+ T extends BaseTransaction & Record<string, unknown>,
561
+ >(tx: T): void {
490
562
  if (typeof tx.TransactionType !== 'string') {
491
563
  throw new ValidationError('Invalid TransactionType')
492
564
  }
@@ -528,7 +600,7 @@ export function validateCredentialType(tx: Record<string, unknown>): void {
528
600
  * PermissionedDomainSet transaction uses 10, other transactions use 8.
529
601
  * @throws Validation Error if the formatting is incorrect
530
602
  */
531
- // eslint-disable-next-line max-lines-per-function, max-params -- separating logic further will add unnecessary complexity
603
+ // eslint-disable-next-line max-params, max-lines-per-function -- separating logic further will add unnecessary complexity
532
604
  export function validateCredentialsList(
533
605
  credentials: unknown,
534
606
  transactionType: string,
@@ -538,7 +610,7 @@ export function validateCredentialsList(
538
610
  if (credentials == null) {
539
611
  return
540
612
  }
541
- if (!Array.isArray(credentials)) {
613
+ if (!isArray(credentials)) {
542
614
  throw new ValidationError(
543
615
  `${transactionType}: Credentials must be an array`,
544
616
  )
@@ -565,7 +637,8 @@ export function validateCredentialsList(
565
637
  )
566
638
  }
567
639
  })
568
- if (containsDuplicates(credentials)) {
640
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
641
+ if (containsDuplicates(credentials as string[] | AuthorizeCredential[])) {
569
642
  throw new ValidationError(
570
643
  `${transactionType}: Credentials cannot contain duplicate elements`,
571
644
  )
@@ -47,6 +47,10 @@ export interface EscrowCreate extends BaseTransaction {
47
47
  * payment, such as a hosted recipient at the destination address.
48
48
  */
49
49
  DestinationTag?: number
50
+
51
+ FinishFunction?: string
52
+
53
+ Data?: string
50
54
  }
51
55
 
52
56
  /**
@@ -75,9 +79,13 @@ export function validateEscrowCreate(tx: Record<string, unknown>): void {
75
79
  )
76
80
  }
77
81
 
78
- if (tx.FinishAfter === undefined && tx.Condition === undefined) {
82
+ if (
83
+ tx.FinishAfter === undefined &&
84
+ tx.Condition === undefined &&
85
+ tx.FinishFunction === undefined
86
+ ) {
79
87
  throw new ValidationError(
80
- 'EscrowCreate: Either Condition or FinishAfter must be specified',
88
+ 'EscrowCreate: Either FinishAfter, Condition, or FinishFunction must be specified',
81
89
  )
82
90
  }
83
91
 
@@ -38,6 +38,8 @@ export interface EscrowFinish extends BaseTransaction {
38
38
  * The credentials included must not be expired.
39
39
  */
40
40
  CredentialIDs?: string[]
41
+
42
+ ComputationAllowance?: number
41
43
  }
42
44
 
43
45
  /**
@@ -95,14 +95,25 @@ export {
95
95
  } from './paymentChannelClaim'
96
96
  export { PaymentChannelCreate } from './paymentChannelCreate'
97
97
  export { PaymentChannelFund } from './paymentChannelFund'
98
+ export { PermissionedDomainSet } from './permissionedDomainSet'
99
+ export { PermissionedDomainDelete } from './permissionedDomainDelete'
98
100
  export { SetFee, SetFeePreAmendment, SetFeePostAmendment } from './setFee'
99
101
  export { SetRegularKey } from './setRegularKey'
100
102
  export { SignerListSet } from './signerListSet'
101
103
  export { TicketCreate } from './ticketCreate'
102
104
  export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
103
105
  export { UNLModify } from './UNLModify'
104
- export { PermissionedDomainSet } from './permissionedDomainSet'
105
- export { PermissionedDomainDelete } from './permissionedDomainDelete'
106
+ export { VaultClawback } from './vaultClawback'
107
+ export {
108
+ VaultCreate,
109
+ VaultCreateFlags,
110
+ VaultCreateFlagsInterface,
111
+ VaultWithdrawalPolicy,
112
+ } from './vaultCreate'
113
+ export { VaultDelete } from './vaultDelete'
114
+ export { VaultDeposit } from './vaultDeposit'
115
+ export { VaultSet } from './vaultSet'
116
+ export { VaultWithdraw } from './vaultWithdraw'
106
117
  export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation'
107
118
  export { XChainAddClaimAttestation } from './XChainAddClaimAttestation'
108
119
  export { XChainClaim } from './XChainClaim'
@@ -4,7 +4,9 @@ import { isHex } from '../utils'
4
4
 
5
5
  import {
6
6
  BaseTransaction,
7
+ isArray,
7
8
  isNumber,
9
+ isRecord,
8
10
  isString,
9
11
  validateBaseTransaction,
10
12
  validateOptionalField,
@@ -90,7 +92,7 @@ export function validateOracleSet(tx: Record<string, unknown>): void {
90
92
  tx,
91
93
  'PriceDataSeries',
92
94
  (value: unknown): value is PriceData => {
93
- if (!Array.isArray(value)) {
95
+ if (!isArray(value)) {
94
96
  throw new ValidationError('OracleSet: PriceDataSeries must be an array')
95
97
  }
96
98
 
@@ -102,14 +104,15 @@ export function validateOracleSet(tx: Record<string, unknown>): void {
102
104
 
103
105
  // TODO: add support for handling inner objects easier (similar to validateRequiredField/validateOptionalField)
104
106
  for (const priceData of value) {
105
- if (typeof priceData !== 'object') {
107
+ if (!isRecord(priceData)) {
106
108
  throw new ValidationError(
107
109
  'OracleSet: PriceDataSeries must be an array of objects',
108
110
  )
109
111
  }
110
112
 
111
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
112
- if (priceData.PriceData == null) {
113
+ const priceDataInner = priceData.PriceData
114
+
115
+ if (!isRecord(priceDataInner)) {
113
116
  throw new ValidationError(
114
117
  'OracleSet: PriceDataSeries must have a `PriceData` object',
115
118
  )
@@ -122,15 +125,16 @@ export function validateOracleSet(tx: Record<string, unknown>): void {
122
125
  )
123
126
  }
124
127
 
125
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
126
- if (typeof priceData.PriceData.BaseAsset !== 'string') {
128
+ if (
129
+ priceDataInner.BaseAsset == null ||
130
+ typeof priceDataInner.BaseAsset !== 'string'
131
+ ) {
127
132
  throw new ValidationError(
128
133
  'OracleSet: PriceDataSeries must have a `BaseAsset` string',
129
134
  )
130
135
  }
131
136
 
132
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
133
- if (typeof priceData.PriceData.QuoteAsset !== 'string') {
137
+ if (typeof priceDataInner.QuoteAsset !== 'string') {
134
138
  throw new ValidationError(
135
139
  'OracleSet: PriceDataSeries must have a `QuoteAsset` string',
136
140
  )
@@ -138,34 +142,31 @@ export function validateOracleSet(tx: Record<string, unknown>): void {
138
142
 
139
143
  // Either AssetPrice and Scale are both present or both excluded
140
144
  if (
141
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
142
- (priceData.PriceData.AssetPrice == null) !==
143
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
144
- (priceData.PriceData.Scale == null)
145
+ (priceDataInner.AssetPrice == null) !==
146
+ (priceDataInner.Scale == null)
145
147
  ) {
146
148
  throw new ValidationError(
147
149
  'OracleSet: PriceDataSeries must have both `AssetPrice` and `Scale` if any are present',
148
150
  )
149
151
  }
150
152
 
151
- /* eslint-disable @typescript-eslint/no-unsafe-member-access, max-depth --
152
- we need to validate priceData.PriceData.AssetPrice value */
153
- if ('AssetPrice' in priceData.PriceData) {
154
- if (!isNumber(priceData.PriceData.AssetPrice)) {
155
- if (typeof priceData.PriceData.AssetPrice !== 'string') {
153
+ /* eslint-disable max-depth --
154
+ we need to validate priceDataInner.AssetPrice value */
155
+ if ('AssetPrice' in priceDataInner) {
156
+ if (!isNumber(priceDataInner.AssetPrice)) {
157
+ if (typeof priceDataInner.AssetPrice !== 'string') {
156
158
  throw new ValidationError(
157
159
  'OracleSet: Field AssetPrice must be a string or a number',
158
160
  )
159
161
  }
160
- if (!isHex(priceData.PriceData.AssetPrice)) {
162
+ if (!isHex(priceDataInner.AssetPrice)) {
161
163
  throw new ValidationError(
162
164
  'OracleSet: Field AssetPrice must be a valid hex string',
163
165
  )
164
166
  }
165
167
  if (
166
- priceData.PriceData.AssetPrice.length <
167
- MINIMUM_ASSET_PRICE_LENGTH ||
168
- priceData.PriceData.AssetPrice.length > MAXIMUM_ASSET_PRICE_LENGTH
168
+ priceDataInner.AssetPrice.length < MINIMUM_ASSET_PRICE_LENGTH ||
169
+ priceDataInner.AssetPrice.length > MAXIMUM_ASSET_PRICE_LENGTH
169
170
  ) {
170
171
  throw new ValidationError(
171
172
  `OracleSet: Length of AssetPrice field must be between ${MINIMUM_ASSET_PRICE_LENGTH} and ${MAXIMUM_ASSET_PRICE_LENGTH} characters long`,
@@ -173,26 +174,18 @@ export function validateOracleSet(tx: Record<string, unknown>): void {
173
174
  }
174
175
  }
175
176
  }
176
- /* eslint-enable @typescript-eslint/no-unsafe-member-access, max-depth */
177
177
 
178
- if (
179
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
180
- 'Scale' in priceData.PriceData &&
181
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
182
- !isNumber(priceData.PriceData.Scale)
183
- ) {
184
- throw new ValidationError('OracleSet: invalid field Scale')
185
- }
178
+ if ('Scale' in priceDataInner) {
179
+ if (!isNumber(priceDataInner.Scale)) {
180
+ throw new ValidationError('OracleSet: invalid field Scale')
181
+ }
186
182
 
187
- if (
188
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
189
- priceData.PriceData.Scale < 0 ||
190
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
191
- priceData.PriceData.Scale > SCALE_MAX
192
- ) {
193
- throw new ValidationError(
194
- `OracleSet: Scale must be in range 0-${SCALE_MAX}`,
195
- )
183
+ if (priceDataInner.Scale < 0 || priceDataInner.Scale > SCALE_MAX) {
184
+ throw new ValidationError(
185
+ `OracleSet: Scale must be in range 0-${SCALE_MAX}`,
186
+ )
187
+ }
188
+ /* eslint-enable max-depth */
196
189
  }
197
190
  }
198
191
  return true
@@ -14,6 +14,7 @@ import {
14
14
  Account,
15
15
  validateCredentialsList,
16
16
  MAX_AUTHORIZED_CREDENTIALS,
17
+ isArray,
17
18
  } from './common'
18
19
  import type { TransactionMetadataBase } from './metadata'
19
20
 
@@ -119,6 +120,9 @@ export interface Payment extends BaseTransaction {
119
120
  * to this amount instead.
120
121
  */
121
122
  Amount: Amount | MPTAmount
123
+
124
+ DeliverMax?: Amount | MPTAmount
125
+
122
126
  /** The unique address of the account receiving the payment. */
123
127
  Destination: Account
124
128
  /**
@@ -195,11 +199,7 @@ export function validatePayment(tx: Record<string, unknown>): void {
195
199
  throw new ValidationError('PaymentTransaction: InvoiceID must be a string')
196
200
  }
197
201
 
198
- if (
199
- tx.Paths !== undefined &&
200
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
201
- !isPaths(tx.Paths as Array<Array<Record<string, unknown>>>)
202
- ) {
202
+ if (tx.Paths !== undefined && !isPaths(tx.Paths)) {
203
203
  throw new ValidationError('PaymentTransaction: invalid Paths')
204
204
  }
205
205
 
@@ -208,6 +208,12 @@ export function validatePayment(tx: Record<string, unknown>): void {
208
208
  }
209
209
 
210
210
  checkPartialPayment(tx)
211
+
212
+ if (tx.DeliverMax != null) {
213
+ throw new ValidationError(
214
+ 'PaymentTransaction: Cannot have DeliverMax in a submitted transaction',
215
+ )
216
+ }
211
217
  }
212
218
 
213
219
  function checkPartialPayment(tx: Record<string, unknown>): void {
@@ -276,12 +282,12 @@ function isPath(path: unknown): path is Path {
276
282
  }
277
283
 
278
284
  function isPaths(paths: unknown): paths is Path[] {
279
- if (!Array.isArray(paths) || paths.length === 0) {
285
+ if (!isArray(paths) || paths.length === 0) {
280
286
  return false
281
287
  }
282
288
 
283
289
  for (const path of paths) {
284
- if (!Array.isArray(path) || path.length === 0) {
290
+ if (!isArray(path) || path.length === 0) {
285
291
  return false
286
292
  }
287
293
 
@@ -1,7 +1,15 @@
1
1
  import { ValidationError } from '../../errors'
2
2
  import { SignerEntry } from '../common'
3
3
 
4
- import { BaseTransaction, isArray, validateBaseTransaction } from './common'
4
+ import {
5
+ BaseTransaction,
6
+ isArray,
7
+ isNumber,
8
+ isRecord,
9
+ isString,
10
+ validateBaseTransaction,
11
+ validateRequiredField,
12
+ } from './common'
5
13
 
6
14
  /**
7
15
  * The SignerListSet transaction creates, replaces, or removes a list of
@@ -39,27 +47,14 @@ const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u
39
47
  export function validateSignerListSet(tx: Record<string, unknown>): void {
40
48
  validateBaseTransaction(tx)
41
49
 
42
- if (tx.SignerQuorum === undefined) {
43
- throw new ValidationError('SignerListSet: missing field SignerQuorum')
44
- }
45
-
46
- if (typeof tx.SignerQuorum !== 'number') {
47
- throw new ValidationError('SignerListSet: invalid SignerQuorum')
48
- }
50
+ validateRequiredField(tx, 'SignerQuorum', isNumber)
49
51
 
50
52
  // All other checks are for if SignerQuorum is greater than 0
51
53
  if (tx.SignerQuorum === 0) {
52
54
  return
53
55
  }
54
56
 
55
- if (tx.SignerEntries === undefined) {
56
- throw new ValidationError('SignerListSet: missing field SignerEntries')
57
- }
58
-
59
- if (!isArray(tx.SignerEntries)) {
60
- throw new ValidationError('SignerListSet: invalid SignerEntries')
61
- }
62
-
57
+ validateRequiredField(tx, 'SignerEntries', isArray)
63
58
  if (tx.SignerEntries.length === 0) {
64
59
  throw new ValidationError(
65
60
  'SignerListSet: need at least 1 member in SignerEntries',
@@ -73,12 +68,17 @@ export function validateSignerListSet(tx: Record<string, unknown>): void {
73
68
  }
74
69
 
75
70
  for (const entry of tx.SignerEntries) {
76
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Should be a SignerEntry
77
- const signerEntry = entry as SignerEntry
78
- const { WalletLocator } = signerEntry.SignerEntry
71
+ if (!isRecord(entry) || !isRecord(entry.SignerEntry)) {
72
+ throw new ValidationError(
73
+ 'SignerListSet: SignerEntries must be an array of SignerEntry objects',
74
+ )
75
+ }
76
+ const signerEntry = entry.SignerEntry
77
+ const { WalletLocator } = signerEntry
79
78
  if (
80
- WalletLocator !== undefined &&
81
- !HEX_WALLET_LOCATOR_REGEX.test(WalletLocator)
79
+ WalletLocator != null &&
80
+ (!isString(WalletLocator) ||
81
+ !HEX_WALLET_LOCATOR_REGEX.test(WalletLocator))
82
82
  ) {
83
83
  throw new ValidationError(
84
84
  `SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value`,