xrpjson 0.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 (367) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +183 -0
  3. package/dist/errors.d.ts +20 -0
  4. package/dist/errors.d.ts.map +1 -0
  5. package/dist/errors.js +27 -0
  6. package/dist/errors.js.map +1 -0
  7. package/dist/fp/factories/account-delete.d.ts +33 -0
  8. package/dist/fp/factories/account-delete.d.ts.map +1 -0
  9. package/dist/fp/factories/account-delete.js +138 -0
  10. package/dist/fp/factories/account-delete.js.map +1 -0
  11. package/dist/fp/factories/account-set.d.ts +31 -0
  12. package/dist/fp/factories/account-set.d.ts.map +1 -0
  13. package/dist/fp/factories/account-set.js +44 -0
  14. package/dist/fp/factories/account-set.js.map +1 -0
  15. package/dist/fp/factories/amm-bid.d.ts +134 -0
  16. package/dist/fp/factories/amm-bid.d.ts.map +1 -0
  17. package/dist/fp/factories/amm-bid.js +82 -0
  18. package/dist/fp/factories/amm-bid.js.map +1 -0
  19. package/dist/fp/factories/amm-clawback.d.ts +166 -0
  20. package/dist/fp/factories/amm-clawback.d.ts.map +1 -0
  21. package/dist/fp/factories/amm-clawback.js +143 -0
  22. package/dist/fp/factories/amm-clawback.js.map +1 -0
  23. package/dist/fp/factories/amm-create.d.ts +91 -0
  24. package/dist/fp/factories/amm-create.d.ts.map +1 -0
  25. package/dist/fp/factories/amm-create.js +140 -0
  26. package/dist/fp/factories/amm-create.js.map +1 -0
  27. package/dist/fp/factories/amm-delete.d.ts +84 -0
  28. package/dist/fp/factories/amm-delete.d.ts.map +1 -0
  29. package/dist/fp/factories/amm-delete.js +36 -0
  30. package/dist/fp/factories/amm-delete.js.map +1 -0
  31. package/dist/fp/factories/amm-deposit.d.ts +109 -0
  32. package/dist/fp/factories/amm-deposit.d.ts.map +1 -0
  33. package/dist/fp/factories/amm-deposit.js +68 -0
  34. package/dist/fp/factories/amm-deposit.js.map +1 -0
  35. package/dist/fp/factories/amm-vote.d.ts +87 -0
  36. package/dist/fp/factories/amm-vote.d.ts.map +1 -0
  37. package/dist/fp/factories/amm-vote.js +53 -0
  38. package/dist/fp/factories/amm-vote.js.map +1 -0
  39. package/dist/fp/factories/amm-withdraw.d.ts +131 -0
  40. package/dist/fp/factories/amm-withdraw.d.ts.map +1 -0
  41. package/dist/fp/factories/amm-withdraw.js +147 -0
  42. package/dist/fp/factories/amm-withdraw.js.map +1 -0
  43. package/dist/fp/factories/batch.d.ts +133 -0
  44. package/dist/fp/factories/batch.d.ts.map +1 -0
  45. package/dist/fp/factories/batch.js +264 -0
  46. package/dist/fp/factories/batch.js.map +1 -0
  47. package/dist/fp/factories/check-cancel.d.ts +22 -0
  48. package/dist/fp/factories/check-cancel.d.ts.map +1 -0
  49. package/dist/fp/factories/check-cancel.js +119 -0
  50. package/dist/fp/factories/check-cancel.js.map +1 -0
  51. package/dist/fp/factories/check-cash.d.ts +84 -0
  52. package/dist/fp/factories/check-cash.d.ts.map +1 -0
  53. package/dist/fp/factories/check-cash.js +95 -0
  54. package/dist/fp/factories/check-cash.js.map +1 -0
  55. package/dist/fp/factories/check-create.d.ts +82 -0
  56. package/dist/fp/factories/check-create.d.ts.map +1 -0
  57. package/dist/fp/factories/check-create.js +101 -0
  58. package/dist/fp/factories/check-create.js.map +1 -0
  59. package/dist/fp/factories/clawback.d.ts +160 -0
  60. package/dist/fp/factories/clawback.d.ts.map +1 -0
  61. package/dist/fp/factories/clawback.js +111 -0
  62. package/dist/fp/factories/clawback.js.map +1 -0
  63. package/dist/fp/factories/confidential-mpt-clawback.d.ts +24 -0
  64. package/dist/fp/factories/confidential-mpt-clawback.d.ts.map +1 -0
  65. package/dist/fp/factories/confidential-mpt-clawback.js +200 -0
  66. package/dist/fp/factories/confidential-mpt-clawback.js.map +1 -0
  67. package/dist/fp/factories/confidential-mpt-convert-back.d.ts +32 -0
  68. package/dist/fp/factories/confidential-mpt-convert-back.d.ts.map +1 -0
  69. package/dist/fp/factories/confidential-mpt-convert-back.js +203 -0
  70. package/dist/fp/factories/confidential-mpt-convert-back.js.map +1 -0
  71. package/dist/fp/factories/confidential-mpt-convert.d.ts +32 -0
  72. package/dist/fp/factories/confidential-mpt-convert.d.ts.map +1 -0
  73. package/dist/fp/factories/confidential-mpt-convert.js +209 -0
  74. package/dist/fp/factories/confidential-mpt-convert.js.map +1 -0
  75. package/dist/fp/factories/confidential-mpt-merge-inbox.d.ts +18 -0
  76. package/dist/fp/factories/confidential-mpt-merge-inbox.d.ts.map +1 -0
  77. package/dist/fp/factories/confidential-mpt-merge-inbox.js +130 -0
  78. package/dist/fp/factories/confidential-mpt-merge-inbox.js.map +1 -0
  79. package/dist/fp/factories/confidential-mpt-send.d.ts +38 -0
  80. package/dist/fp/factories/confidential-mpt-send.d.ts.map +1 -0
  81. package/dist/fp/factories/confidential-mpt-send.js +254 -0
  82. package/dist/fp/factories/confidential-mpt-send.js.map +1 -0
  83. package/dist/fp/factories/credential-accept.d.ts +23 -0
  84. package/dist/fp/factories/credential-accept.d.ts.map +1 -0
  85. package/dist/fp/factories/credential-accept.js +135 -0
  86. package/dist/fp/factories/credential-accept.js.map +1 -0
  87. package/dist/fp/factories/credential-create.d.ts +24 -0
  88. package/dist/fp/factories/credential-create.d.ts.map +1 -0
  89. package/dist/fp/factories/credential-create.js +204 -0
  90. package/dist/fp/factories/credential-create.js.map +1 -0
  91. package/dist/fp/factories/credential-delete.d.ts +33 -0
  92. package/dist/fp/factories/credential-delete.d.ts.map +1 -0
  93. package/dist/fp/factories/credential-delete.js +167 -0
  94. package/dist/fp/factories/credential-delete.js.map +1 -0
  95. package/dist/fp/factories/delegate-set.d.ts +52 -0
  96. package/dist/fp/factories/delegate-set.d.ts.map +1 -0
  97. package/dist/fp/factories/delegate-set.js +190 -0
  98. package/dist/fp/factories/delegate-set.js.map +1 -0
  99. package/dist/fp/factories/deposit-preauth.d.ts +183 -0
  100. package/dist/fp/factories/deposit-preauth.d.ts.map +1 -0
  101. package/dist/fp/factories/deposit-preauth.js +159 -0
  102. package/dist/fp/factories/deposit-preauth.js.map +1 -0
  103. package/dist/fp/factories/did-delete.d.ts +22 -0
  104. package/dist/fp/factories/did-delete.d.ts.map +1 -0
  105. package/dist/fp/factories/did-delete.js +126 -0
  106. package/dist/fp/factories/did-delete.js.map +1 -0
  107. package/dist/fp/factories/did-set.d.ts +68 -0
  108. package/dist/fp/factories/did-set.d.ts.map +1 -0
  109. package/dist/fp/factories/did-set.js +178 -0
  110. package/dist/fp/factories/did-set.js.map +1 -0
  111. package/dist/fp/factories/escrow-cancel.d.ts +28 -0
  112. package/dist/fp/factories/escrow-cancel.d.ts.map +1 -0
  113. package/dist/fp/factories/escrow-cancel.js +127 -0
  114. package/dist/fp/factories/escrow-cancel.js.map +1 -0
  115. package/dist/fp/factories/escrow-create.d.ts +103 -0
  116. package/dist/fp/factories/escrow-create.d.ts.map +1 -0
  117. package/dist/fp/factories/escrow-create.js +133 -0
  118. package/dist/fp/factories/escrow-create.js.map +1 -0
  119. package/dist/fp/factories/escrow-finish.d.ts +39 -0
  120. package/dist/fp/factories/escrow-finish.d.ts.map +1 -0
  121. package/dist/fp/factories/escrow-finish.js +173 -0
  122. package/dist/fp/factories/escrow-finish.js.map +1 -0
  123. package/dist/fp/factories/ledger-state-fix.d.ts +31 -0
  124. package/dist/fp/factories/ledger-state-fix.d.ts.map +1 -0
  125. package/dist/fp/factories/ledger-state-fix.js +163 -0
  126. package/dist/fp/factories/ledger-state-fix.js.map +1 -0
  127. package/dist/fp/factories/loan-broker-cover-clawback.d.ts +106 -0
  128. package/dist/fp/factories/loan-broker-cover-clawback.d.ts.map +1 -0
  129. package/dist/fp/factories/loan-broker-cover-clawback.js +122 -0
  130. package/dist/fp/factories/loan-broker-cover-clawback.js.map +1 -0
  131. package/dist/fp/factories/loan-broker-cover-deposit.d.ts +65 -0
  132. package/dist/fp/factories/loan-broker-cover-deposit.d.ts.map +1 -0
  133. package/dist/fp/factories/loan-broker-cover-deposit.js +81 -0
  134. package/dist/fp/factories/loan-broker-cover-deposit.js.map +1 -0
  135. package/dist/fp/factories/loan-broker-cover-withdraw.d.ts +96 -0
  136. package/dist/fp/factories/loan-broker-cover-withdraw.d.ts.map +1 -0
  137. package/dist/fp/factories/loan-broker-cover-withdraw.js +116 -0
  138. package/dist/fp/factories/loan-broker-cover-withdraw.js.map +1 -0
  139. package/dist/fp/factories/loan-broker-delete.d.ts +20 -0
  140. package/dist/fp/factories/loan-broker-delete.d.ts.map +1 -0
  141. package/dist/fp/factories/loan-broker-delete.js +94 -0
  142. package/dist/fp/factories/loan-broker-delete.js.map +1 -0
  143. package/dist/fp/factories/loan-broker-set.d.ts +108 -0
  144. package/dist/fp/factories/loan-broker-set.d.ts.map +1 -0
  145. package/dist/fp/factories/loan-broker-set.js +133 -0
  146. package/dist/fp/factories/loan-broker-set.js.map +1 -0
  147. package/dist/fp/factories/loan-delete.d.ts +18 -0
  148. package/dist/fp/factories/loan-delete.d.ts.map +1 -0
  149. package/dist/fp/factories/loan-delete.js +95 -0
  150. package/dist/fp/factories/loan-delete.js.map +1 -0
  151. package/dist/fp/factories/loan-manage.d.ts +72 -0
  152. package/dist/fp/factories/loan-manage.d.ts.map +1 -0
  153. package/dist/fp/factories/loan-manage.js +79 -0
  154. package/dist/fp/factories/loan-manage.js.map +1 -0
  155. package/dist/fp/factories/loan-pay.d.ts +70 -0
  156. package/dist/fp/factories/loan-pay.d.ts.map +1 -0
  157. package/dist/fp/factories/loan-pay.js +115 -0
  158. package/dist/fp/factories/loan-pay.js.map +1 -0
  159. package/dist/fp/factories/loan-set.d.ts +67 -0
  160. package/dist/fp/factories/loan-set.d.ts.map +1 -0
  161. package/dist/fp/factories/loan-set.js +102 -0
  162. package/dist/fp/factories/loan-set.js.map +1 -0
  163. package/dist/fp/factories/mptoken-authorize.d.ts +83 -0
  164. package/dist/fp/factories/mptoken-authorize.d.ts.map +1 -0
  165. package/dist/fp/factories/mptoken-authorize.js +63 -0
  166. package/dist/fp/factories/mptoken-authorize.js.map +1 -0
  167. package/dist/fp/factories/mptoken-issuance-create.d.ts +71 -0
  168. package/dist/fp/factories/mptoken-issuance-create.d.ts.map +1 -0
  169. package/dist/fp/factories/mptoken-issuance-create.js +135 -0
  170. package/dist/fp/factories/mptoken-issuance-create.js.map +1 -0
  171. package/dist/fp/factories/mptoken-issuance-destroy.d.ts +32 -0
  172. package/dist/fp/factories/mptoken-issuance-destroy.d.ts.map +1 -0
  173. package/dist/fp/factories/mptoken-issuance-destroy.js +105 -0
  174. package/dist/fp/factories/mptoken-issuance-destroy.js.map +1 -0
  175. package/dist/fp/factories/mptoken-issuance-set.d.ts +196 -0
  176. package/dist/fp/factories/mptoken-issuance-set.d.ts.map +1 -0
  177. package/dist/fp/factories/mptoken-issuance-set.js +333 -0
  178. package/dist/fp/factories/mptoken-issuance-set.js.map +1 -0
  179. package/dist/fp/factories/nftoken-accept-offer.d.ts +108 -0
  180. package/dist/fp/factories/nftoken-accept-offer.d.ts.map +1 -0
  181. package/dist/fp/factories/nftoken-accept-offer.js +105 -0
  182. package/dist/fp/factories/nftoken-accept-offer.js.map +1 -0
  183. package/dist/fp/factories/nftoken-burn.d.ts +27 -0
  184. package/dist/fp/factories/nftoken-burn.d.ts.map +1 -0
  185. package/dist/fp/factories/nftoken-burn.js +125 -0
  186. package/dist/fp/factories/nftoken-burn.js.map +1 -0
  187. package/dist/fp/factories/nftoken-cancel-offer.d.ts +19 -0
  188. package/dist/fp/factories/nftoken-cancel-offer.d.ts.map +1 -0
  189. package/dist/fp/factories/nftoken-cancel-offer.js +143 -0
  190. package/dist/fp/factories/nftoken-cancel-offer.js.map +1 -0
  191. package/dist/fp/factories/nftoken-create-offer.d.ts +159 -0
  192. package/dist/fp/factories/nftoken-create-offer.d.ts.map +1 -0
  193. package/dist/fp/factories/nftoken-create-offer.js +212 -0
  194. package/dist/fp/factories/nftoken-create-offer.js.map +1 -0
  195. package/dist/fp/factories/nftoken-mint.d.ts +155 -0
  196. package/dist/fp/factories/nftoken-mint.d.ts.map +1 -0
  197. package/dist/fp/factories/nftoken-mint.js +165 -0
  198. package/dist/fp/factories/nftoken-mint.js.map +1 -0
  199. package/dist/fp/factories/nftoken-modify.d.ts +28 -0
  200. package/dist/fp/factories/nftoken-modify.d.ts.map +1 -0
  201. package/dist/fp/factories/nftoken-modify.js +209 -0
  202. package/dist/fp/factories/nftoken-modify.js.map +1 -0
  203. package/dist/fp/factories/offer-cancel.d.ts +21 -0
  204. package/dist/fp/factories/offer-cancel.d.ts.map +1 -0
  205. package/dist/fp/factories/offer-cancel.js +99 -0
  206. package/dist/fp/factories/offer-cancel.js.map +1 -0
  207. package/dist/fp/factories/offer-create.d.ts +125 -0
  208. package/dist/fp/factories/offer-create.d.ts.map +1 -0
  209. package/dist/fp/factories/offer-create.js +230 -0
  210. package/dist/fp/factories/offer-create.js.map +1 -0
  211. package/dist/fp/factories/oracle-delete.d.ts +21 -0
  212. package/dist/fp/factories/oracle-delete.d.ts.map +1 -0
  213. package/dist/fp/factories/oracle-delete.js +101 -0
  214. package/dist/fp/factories/oracle-delete.js.map +1 -0
  215. package/dist/fp/factories/oracle-set.d.ts +40 -0
  216. package/dist/fp/factories/oracle-set.d.ts.map +1 -0
  217. package/dist/fp/factories/oracle-set.js +257 -0
  218. package/dist/fp/factories/oracle-set.js.map +1 -0
  219. package/dist/fp/factories/payment-channel-claim.d.ts +153 -0
  220. package/dist/fp/factories/payment-channel-claim.d.ts.map +1 -0
  221. package/dist/fp/factories/payment-channel-claim.js +118 -0
  222. package/dist/fp/factories/payment-channel-claim.js.map +1 -0
  223. package/dist/fp/factories/payment-channel-create.d.ts +30 -0
  224. package/dist/fp/factories/payment-channel-create.d.ts.map +1 -0
  225. package/dist/fp/factories/payment-channel-create.js +172 -0
  226. package/dist/fp/factories/payment-channel-create.js.map +1 -0
  227. package/dist/fp/factories/payment-channel-fund.d.ts +25 -0
  228. package/dist/fp/factories/payment-channel-fund.d.ts.map +1 -0
  229. package/dist/fp/factories/payment-channel-fund.js +142 -0
  230. package/dist/fp/factories/payment-channel-fund.js.map +1 -0
  231. package/dist/fp/factories/payment.d.ts +65 -0
  232. package/dist/fp/factories/payment.d.ts.map +1 -0
  233. package/dist/fp/factories/payment.js +48 -0
  234. package/dist/fp/factories/payment.js.map +1 -0
  235. package/dist/fp/factories/permissioned-domain-delete.d.ts +18 -0
  236. package/dist/fp/factories/permissioned-domain-delete.d.ts.map +1 -0
  237. package/dist/fp/factories/permissioned-domain-delete.js +88 -0
  238. package/dist/fp/factories/permissioned-domain-delete.js.map +1 -0
  239. package/dist/fp/factories/permissioned-domain-set.d.ts +118 -0
  240. package/dist/fp/factories/permissioned-domain-set.d.ts.map +1 -0
  241. package/dist/fp/factories/permissioned-domain-set.js +100 -0
  242. package/dist/fp/factories/permissioned-domain-set.js.map +1 -0
  243. package/dist/fp/factories/set-regular-key.d.ts +30 -0
  244. package/dist/fp/factories/set-regular-key.d.ts.map +1 -0
  245. package/dist/fp/factories/set-regular-key.js +81 -0
  246. package/dist/fp/factories/set-regular-key.js.map +1 -0
  247. package/dist/fp/factories/signer-list-set.d.ts +61 -0
  248. package/dist/fp/factories/signer-list-set.d.ts.map +1 -0
  249. package/dist/fp/factories/signer-list-set.js +250 -0
  250. package/dist/fp/factories/signer-list-set.js.map +1 -0
  251. package/dist/fp/factories/sponsorship-set.d.ts +148 -0
  252. package/dist/fp/factories/sponsorship-set.d.ts.map +1 -0
  253. package/dist/fp/factories/sponsorship-set.js +201 -0
  254. package/dist/fp/factories/sponsorship-set.js.map +1 -0
  255. package/dist/fp/factories/sponsorship-transfer.d.ts +173 -0
  256. package/dist/fp/factories/sponsorship-transfer.d.ts.map +1 -0
  257. package/dist/fp/factories/sponsorship-transfer.js +195 -0
  258. package/dist/fp/factories/sponsorship-transfer.js.map +1 -0
  259. package/dist/fp/factories/ticket-create.d.ts +20 -0
  260. package/dist/fp/factories/ticket-create.d.ts.map +1 -0
  261. package/dist/fp/factories/ticket-create.js +120 -0
  262. package/dist/fp/factories/ticket-create.js.map +1 -0
  263. package/dist/fp/factories/trust-set.d.ts +100 -0
  264. package/dist/fp/factories/trust-set.d.ts.map +1 -0
  265. package/dist/fp/factories/trust-set.js +111 -0
  266. package/dist/fp/factories/trust-set.js.map +1 -0
  267. package/dist/fp/factories/vault-clawback.d.ts +83 -0
  268. package/dist/fp/factories/vault-clawback.d.ts.map +1 -0
  269. package/dist/fp/factories/vault-clawback.js +91 -0
  270. package/dist/fp/factories/vault-clawback.js.map +1 -0
  271. package/dist/fp/factories/vault-create.d.ts +51 -0
  272. package/dist/fp/factories/vault-create.d.ts.map +1 -0
  273. package/dist/fp/factories/vault-create.js +141 -0
  274. package/dist/fp/factories/vault-create.js.map +1 -0
  275. package/dist/fp/factories/vault-delete.d.ts +20 -0
  276. package/dist/fp/factories/vault-delete.d.ts.map +1 -0
  277. package/dist/fp/factories/vault-delete.js +103 -0
  278. package/dist/fp/factories/vault-delete.js.map +1 -0
  279. package/dist/fp/factories/vault-deposit.d.ts +56 -0
  280. package/dist/fp/factories/vault-deposit.d.ts.map +1 -0
  281. package/dist/fp/factories/vault-deposit.js +85 -0
  282. package/dist/fp/factories/vault-deposit.js.map +1 -0
  283. package/dist/fp/factories/vault-set.d.ts +32 -0
  284. package/dist/fp/factories/vault-set.d.ts.map +1 -0
  285. package/dist/fp/factories/vault-set.js +135 -0
  286. package/dist/fp/factories/vault-set.js.map +1 -0
  287. package/dist/fp/factories/vault-withdraw.d.ts +82 -0
  288. package/dist/fp/factories/vault-withdraw.d.ts.map +1 -0
  289. package/dist/fp/factories/vault-withdraw.js +122 -0
  290. package/dist/fp/factories/vault-withdraw.js.map +1 -0
  291. package/dist/fp/factories/xchain-account-create-commit.d.ts +180 -0
  292. package/dist/fp/factories/xchain-account-create-commit.d.ts.map +1 -0
  293. package/dist/fp/factories/xchain-account-create-commit.js +99 -0
  294. package/dist/fp/factories/xchain-account-create-commit.js.map +1 -0
  295. package/dist/fp/factories/xchain-add-account-create-attestation.d.ts +213 -0
  296. package/dist/fp/factories/xchain-add-account-create-attestation.d.ts.map +1 -0
  297. package/dist/fp/factories/xchain-add-account-create-attestation.js +95 -0
  298. package/dist/fp/factories/xchain-add-account-create-attestation.js.map +1 -0
  299. package/dist/fp/factories/xchain-add-claim-attestation.d.ts +206 -0
  300. package/dist/fp/factories/xchain-add-claim-attestation.d.ts.map +1 -0
  301. package/dist/fp/factories/xchain-add-claim-attestation.js +97 -0
  302. package/dist/fp/factories/xchain-add-claim-attestation.js.map +1 -0
  303. package/dist/fp/factories/xchain-claim.d.ts +187 -0
  304. package/dist/fp/factories/xchain-claim.d.ts.map +1 -0
  305. package/dist/fp/factories/xchain-claim.js +140 -0
  306. package/dist/fp/factories/xchain-claim.js.map +1 -0
  307. package/dist/fp/factories/xchain-commit.d.ts +168 -0
  308. package/dist/fp/factories/xchain-commit.d.ts.map +1 -0
  309. package/dist/fp/factories/xchain-commit.js +137 -0
  310. package/dist/fp/factories/xchain-commit.js.map +1 -0
  311. package/dist/fp/factories/xchain-create-bridge.d.ts +206 -0
  312. package/dist/fp/factories/xchain-create-bridge.d.ts.map +1 -0
  313. package/dist/fp/factories/xchain-create-bridge.js +100 -0
  314. package/dist/fp/factories/xchain-create-bridge.js.map +1 -0
  315. package/dist/fp/factories/xchain-create-claim-id.d.ts +199 -0
  316. package/dist/fp/factories/xchain-create-claim-id.d.ts.map +1 -0
  317. package/dist/fp/factories/xchain-create-claim-id.js +78 -0
  318. package/dist/fp/factories/xchain-create-claim-id.js.map +1 -0
  319. package/dist/fp/factories/xchain-modify-bridge.d.ts +198 -0
  320. package/dist/fp/factories/xchain-modify-bridge.d.ts.map +1 -0
  321. package/dist/fp/factories/xchain-modify-bridge.js +102 -0
  322. package/dist/fp/factories/xchain-modify-bridge.js.map +1 -0
  323. package/dist/fp/index.d.ts +124 -0
  324. package/dist/fp/index.d.ts.map +1 -0
  325. package/dist/fp/index.js +152 -0
  326. package/dist/fp/index.js.map +1 -0
  327. package/dist/fp/shape.d.ts +34 -0
  328. package/dist/fp/shape.d.ts.map +1 -0
  329. package/dist/fp/shape.js +80 -0
  330. package/dist/fp/shape.js.map +1 -0
  331. package/dist/types/amounts.d.ts +49 -0
  332. package/dist/types/amounts.d.ts.map +1 -0
  333. package/dist/types/amounts.js +8 -0
  334. package/dist/types/amounts.js.map +1 -0
  335. package/dist/types/base.d.ts +103 -0
  336. package/dist/types/base.d.ts.map +1 -0
  337. package/dist/types/base.js +2 -0
  338. package/dist/types/base.js.map +1 -0
  339. package/dist/types/common.d.ts +163 -0
  340. package/dist/types/common.d.ts.map +1 -0
  341. package/dist/types/common.js +5 -0
  342. package/dist/types/common.js.map +1 -0
  343. package/dist/types/flags.d.ts +317 -0
  344. package/dist/types/flags.d.ts.map +1 -0
  345. package/dist/types/flags.js +253 -0
  346. package/dist/types/flags.js.map +1 -0
  347. package/dist/types/index.d.ts +10 -0
  348. package/dist/types/index.d.ts.map +1 -0
  349. package/dist/types/index.js +2 -0
  350. package/dist/types/index.js.map +1 -0
  351. package/dist/types/transaction-types.d.ts +7 -0
  352. package/dist/types/transaction-types.d.ts.map +1 -0
  353. package/dist/types/transaction-types.js +2 -0
  354. package/dist/types/transaction-types.js.map +1 -0
  355. package/dist/validation/base.d.ts +8 -0
  356. package/dist/validation/base.d.ts.map +1 -0
  357. package/dist/validation/base.js +79 -0
  358. package/dist/validation/base.js.map +1 -0
  359. package/dist/validation/helpers.d.ts +42 -0
  360. package/dist/validation/helpers.d.ts.map +1 -0
  361. package/dist/validation/helpers.js +154 -0
  362. package/dist/validation/helpers.js.map +1 -0
  363. package/dist/validation/index.d.ts +3 -0
  364. package/dist/validation/index.d.ts.map +1 -0
  365. package/dist/validation/index.js +3 -0
  366. package/dist/validation/index.js.map +1 -0
  367. package/package.json +67 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escrow-create.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/escrow-create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAqBrD,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC;IACzC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC;CAC3D;AAyDD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA4GnE"}
@@ -0,0 +1,133 @@
1
+ import { isAccount, isAmount, isHex, isNumber, isString, } from '../../validation/helpers.js';
2
+ import { ValidationError } from '../../errors.js';
3
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
4
+ // ─── Spec constants ──────────────────────────────────────────────────
5
+ /**
6
+ * Ripple Epoch offset (seconds) between UNIX epoch (1970-01-01) and the
7
+ * XRPL reference epoch (2000-01-01).
8
+ */
9
+ const RIPPLE_EPOCH_OFFSET = 946684800;
10
+ // ─── Helpers ─────────────────────────────────────────────────────────
11
+ /**
12
+ * Per xrpl.js docs (escrowCreate.ts:25–28): "Amount … Must always be a
13
+ * positive value." Validates the sign of an Amount in all three
14
+ * accepted forms (XRP drop string, issued-currency object, MPT object).
15
+ *
16
+ * Rejects zero, negative, `-0`, and unparseable values.
17
+ */
18
+ function isPositiveAmount(amount) {
19
+ if (typeof amount === 'string') {
20
+ if (!/^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u.test(amount)) {
21
+ return false;
22
+ }
23
+ return parseFloat(amount) > 0;
24
+ }
25
+ if (typeof amount !== 'object' || amount === null)
26
+ return false;
27
+ const value = amount.value;
28
+ if (typeof value !== 'string')
29
+ return false;
30
+ if (!/^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/u.test(value)) {
31
+ return false;
32
+ }
33
+ return parseFloat(value) > 0;
34
+ }
35
+ /**
36
+ * Validate a `UInt32` field (any unsigned 32-bit integer). The ledger
37
+ * rejects negative values and non-integers. Used for `CancelAfter` /
38
+ * `FinishAfter` (which the docs further constrain to be ≥ Ripple Epoch,
39
+ * enforced separately) and for `DestinationTag`.
40
+ */
41
+ function isUInt32(value) {
42
+ return (isNumber(value) &&
43
+ Number.isInteger(value) &&
44
+ value >= 0 &&
45
+ value <= 0xffffffff);
46
+ }
47
+ /**
48
+ * Validate a Ripple Epoch timestamp (`UInt32`, must be on or after
49
+ * 2000-01-01). Used for `CancelAfter` / `FinishAfter`.
50
+ */
51
+ function isRippleEpochUInt32(value) {
52
+ return (isNumber(value) &&
53
+ Number.isInteger(value) &&
54
+ value >= RIPPLE_EPOCH_OFFSET &&
55
+ value <= 0xffffffff);
56
+ }
57
+ // ─── Factory ─────────────────────────────────────────────────────────
58
+ export function escrowCreate(props) {
59
+ // ── Account ── required, must be a valid XRPL classic or X-address.
60
+ require(props.Account, 'EscrowCreate: Account is required', isAccount);
61
+ // ── Destination ── required, must be a valid XRPL classic or X-address.
62
+ if (!isAccount(props.Destination)) {
63
+ throw new ValidationError('EscrowCreate: Destination must be a valid XRPL account address');
64
+ }
65
+ // ── Destination ≠ Account ── rippled preclaim temMALFORMED.
66
+ if (props.Destination === props.Account) {
67
+ throw new ValidationError('EscrowCreate: Destination must not equal Account (cannot escrow to yourself)');
68
+ }
69
+ // ── Amount ── required, must be a valid Amount AND strictly positive.
70
+ if (!isAmount(props.Amount)) {
71
+ throw new ValidationError('EscrowCreate: Amount must be a valid Amount (XRP / trust line / MPT form)');
72
+ }
73
+ if (!isPositiveAmount(props.Amount)) {
74
+ throw new ValidationError('EscrowCreate: Amount must be strictly positive (non-zero, non-negative)');
75
+ }
76
+ // ── CancelAfter + FinishAfter ── at least one must be present, and if
77
+ // both are, FinishAfter must precede CancelAfter.
78
+ if (props.CancelAfter === undefined && props.FinishAfter === undefined) {
79
+ throw new ValidationError('EscrowCreate: either CancelAfter or FinishAfter must be specified');
80
+ }
81
+ if (props.CancelAfter !== undefined && !isRippleEpochUInt32(props.CancelAfter)) {
82
+ throw new ValidationError('EscrowCreate: CancelAfter must be a positive integer in seconds since the Ripple Epoch (UInt32)');
83
+ }
84
+ if (props.FinishAfter !== undefined && !isRippleEpochUInt32(props.FinishAfter)) {
85
+ throw new ValidationError('EscrowCreate: FinishAfter must be a positive integer in seconds since the Ripple Epoch (UInt32)');
86
+ }
87
+ if (props.CancelAfter !== undefined &&
88
+ props.FinishAfter !== undefined &&
89
+ props.FinishAfter >= props.CancelAfter) {
90
+ throw new ValidationError('EscrowCreate: FinishAfter must be strictly less than CancelAfter');
91
+ }
92
+ // ── FinishAfter or Condition ── at least one must be present.
93
+ // A pure Condition with no FinishAfter would never release funds if
94
+ // CancelAfter is also absent, and per xrpl.js the spec explicitly
95
+ // requires one of the two.
96
+ if (props.FinishAfter === undefined && props.Condition === undefined) {
97
+ throw new ValidationError('EscrowCreate: either FinishAfter or Condition must be specified');
98
+ }
99
+ // ── Condition ── must be a hex string when present. (xrpl.js only
100
+ // validates the type; the factory enforces hex so obvious typos
101
+ // are caught at the call site rather than at finish time.)
102
+ if (props.Condition !== undefined) {
103
+ if (!isString(props.Condition) || !isHex(props.Condition)) {
104
+ throw new ValidationError('EscrowCreate: Condition must be a hex string (PREIMAGE-SHA-256 crypto-condition)');
105
+ }
106
+ }
107
+ // ── DestinationTag ── optional, must be a UInt32 when present.
108
+ if (props.DestinationTag !== undefined) {
109
+ if (!isUInt32(props.DestinationTag)) {
110
+ throw new ValidationError('EscrowCreate: DestinationTag must be a positive integer (UInt32)');
111
+ }
112
+ }
113
+ return buildFrozenTx('EscrowCreate', props, {
114
+ validate() {
115
+ // Validated at construction.
116
+ },
117
+ toJSON() {
118
+ const json = {};
119
+ for (const k of Object.keys(this)) {
120
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
121
+ continue;
122
+ const v = this[k];
123
+ if (v !== undefined)
124
+ json[k] = v;
125
+ }
126
+ return json;
127
+ },
128
+ with(overrides) {
129
+ return escrowCreate(mergeForWith(this, overrides));
130
+ },
131
+ });
132
+ }
133
+ //# sourceMappingURL=escrow-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escrow-create.js","sourceRoot":"","sources":["../../../src/fp/factories/escrow-create.ts"],"names":[],"mappings":"AAgEA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE;;;GAGG;AACH,MAAM,mBAAmB,GAAG,SAAS,CAAC;AA2CtC,wEAAwE;AAExE;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,MAAc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,CAAC;QACrD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface EscrowFinishProps {
2
+ /** The unique address of the transaction sender (the finisher). */
3
+ Account: string;
4
+ /** Address of the source account that funded the escrow. */
5
+ Owner: string;
6
+ /**
7
+ * Transaction sequence of the `EscrowCreate` transaction that created
8
+ * the held payment to finish. `UInt32`.
9
+ */
10
+ OfferSequence: number;
11
+ /**
12
+ * Hex PREIMAGE-SHA-256 crypto-condition matching the escrow's
13
+ * `Condition` (as set in the original `EscrowCreate`).
14
+ */
15
+ Condition?: string | undefined;
16
+ /**
17
+ * Hex PREIMAGE-SHA-256 crypto-condition fulfillment matching the
18
+ * escrow's `Condition`. Required when the original escrow had a
19
+ * `Condition`.
20
+ */
21
+ Fulfillment?: string | undefined;
22
+ /**
23
+ * Optional credentials authorizing this finish. Each entry is a
24
+ * 64-char hex ledger entry ID. Length must be in [1, 8].
25
+ */
26
+ CredentialIDs?: string[] | undefined;
27
+ /** Bit-flags for this transaction. EscrowFinish has no defined flags. */
28
+ Flags?: number | undefined;
29
+ Fee?: string | undefined;
30
+ Sequence?: number | undefined;
31
+ }
32
+ export interface EscrowFinish extends Readonly<EscrowFinishProps> {
33
+ readonly TransactionType: 'EscrowFinish';
34
+ validate(): void;
35
+ toJSON(): Record<string, unknown>;
36
+ with(overrides: Partial<EscrowFinishProps>): EscrowFinish;
37
+ }
38
+ export declare function escrowFinish(props: EscrowFinishProps): EscrowFinish;
39
+ //# sourceMappingURL=escrow-finish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escrow-finish.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/escrow-finish.ts"],"names":[],"mappings":"AAmGA,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC;IACzC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC;CAC3D;AAmBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAkGnE"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Functional EscrowFinish factory — frozen-object style.
3
+ *
4
+ * Deliver XRP (or, under the TokenEscrow amendment, IOU/MPT tokens) from
5
+ * a held escrow to the recipient. The original `EscrowCreate` may have
6
+ * specified a `Condition` (in which case the matching `Fulfillment` is
7
+ * required to unlock the funds) and/or a `FinishAfter` time. Validation
8
+ * happens at construction; there is no way to construct an invalid tx.
9
+ *
10
+ * import { escrowFinish } from 'xrplt/fp';
11
+ * const tx = escrowFinish({
12
+ * Account, Owner, OfferSequence,
13
+ * Condition: 'A0258020…', Fulfillment: 'A0028000',
14
+ * });
15
+ * const j = tx.toJSON();
16
+ * const tx2 = tx.with({ Fulfillment: 'A0028001' });
17
+ *
18
+ * Affected amendments:
19
+ * - `Escrow` (base EscrowFinish)
20
+ * - `TokenEscrow` (XLS-85: IOU/MPT tokens in addition to XRP)
21
+ * - `Credentials` (CredentialIDs field for permissioned-domain auth)
22
+ *
23
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/escrowfinish
24
+ * @see https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0085-token-escrow
25
+ *
26
+ * ## Divergences
27
+ *
28
+ * Compared with `src/transactions/escrow-finish.ts`, this factory adds
29
+ * preclaim guards the class API skips:
30
+ *
31
+ * 1. **`CredentialIDs` field is supported.**
32
+ * Source: xrpl.js
33
+ * (`repo/packages/xrpl/src/models/transactions/escrowFinish.ts:40`) —
34
+ * "`CredentialIDs?: string[]` — Credentials associated with the
35
+ * sender of this transaction. The credentials included must not be
36
+ * expired." xrpl.org `escrowfinish.md` Fields table also lists
37
+ * `CredentialIDs` as a Vector256 field. The local class predates
38
+ * the Credentials amendment and silently drops the field.
39
+ *
40
+ * 2. **`CredentialIDs` length must be in [1, MAX_AUTHORIZED_CREDENTIALS].**
41
+ * Source: xrpl.js `validateCredentialsList`
42
+ * (`packages/xrpl/src/models/transactions/common.ts:1106–1148`) —
43
+ * "Credentials length cannot exceed 8 elements" / "Credentials
44
+ * cannot be an empty array." `MAX_AUTHORIZED_CREDENTIALS = 8`
45
+ * (`common.ts:28`) is the cap for non-DomainSet transactions. The
46
+ * class does not model the field.
47
+ *
48
+ * 3. **`CredentialIDs[i]` must be a 64-character hex string.**
49
+ * Source: xrpl.org `escrowfinish.md` — "Each member of the array
50
+ * must be the ledger entry ID of a Credential entry in the ledger"
51
+ * (HASH256, 64 hex chars). The class does not model the field.
52
+ *
53
+ * 4. **`Condition` must be a hex string.**
54
+ * Source: xrpl.org `escrowfinish.md` fields table — "`Condition`
55
+ * … String - Hexadecimal, Internal Type: Blob." The class only
56
+ * checks `isString(Condition)` and accepts arbitrary text.
57
+ *
58
+ * 5. **`Fulfillment` must be a hex string.**
59
+ * Source: xrpl.org `escrowfinish.md` fields table — "`Fulfillment`
60
+ * … String - Hexadecmial, Internal Type: Blob." The class only
61
+ * checks `isString(Fulfillment)`. Note: a hex validation here is
62
+ * a preclaim-style guard — the actual fulfillment is parsed by
63
+ * rippled, which can still reject a syntactically-hex but
64
+ * cryptographically-invalid string at apply time.
65
+ *
66
+ * 6. **`OfferSequence` must be a UInt32 (non-negative integer).**
67
+ * Source: xrpl.org `escrowfinish.md` fields table — "`OfferSequence`
68
+ * … Number, Internal Type: UInt32." xrpl.js `validateEscrowFinish`
69
+ * (`escrowFinish.ts:61–71`) rejects `NaN` and non-numeric inputs.
70
+ * The class uses `isNumber`, which accepts negatives and floats.
71
+ *
72
+ * 7. **`CredentialIDs` must not contain duplicates.**
73
+ * Source: xrpl.js `validateCredentialsList`
74
+ * (`packages/xrpl/src/models/transactions/common.ts:1142–1147`) —
75
+ * "`Credentials` cannot contain duplicate elements." The class
76
+ * does not model the field.
77
+ */
78
+ import { isAccount, isArray, isHex, isNumber, isString, } from '../../validation/helpers.js';
79
+ import { ValidationError } from '../../errors.js';
80
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
81
+ // ─── Spec constants ──────────────────────────────────────────────────
82
+ // xrpl.js caps non-DomainSet credential arrays at 8 entries.
83
+ // (packages/xrpl/src/models/transactions/common.ts:
84
+ // MAX_AUTHORIZED_CREDENTIALS = 8)
85
+ const MAX_CREDENTIAL_IDS = 8;
86
+ // Credential IDs are 64-char hex (same as ledger entry IDs / HASH256).
87
+ const CREDENTIAL_ID_LENGTH = 64;
88
+ // ─── Helpers ─────────────────────────────────────────────────────────
89
+ /**
90
+ * Validate a `UInt32` field (any unsigned 32-bit integer). The ledger
91
+ * rejects negative values and non-integers. Used for `OfferSequence`.
92
+ */
93
+ function isUInt32(value) {
94
+ return (isNumber(value) &&
95
+ Number.isInteger(value) &&
96
+ value >= 0 &&
97
+ value <= 0xffffffff);
98
+ }
99
+ // ─── Factory ─────────────────────────────────────────────────────────
100
+ export function escrowFinish(props) {
101
+ // ── Account ── required, must be a valid XRPL classic or X-address.
102
+ require(props.Account, 'EscrowFinish: Account is required', isAccount);
103
+ // ── Owner ── required, must be a valid XRPL classic or X-address.
104
+ // `Owner` is the source account that funded the escrow; it need
105
+ // not equal `Account` (anyone can finish an escrow).
106
+ if (!isAccount(props.Owner)) {
107
+ throw new ValidationError('EscrowFinish: Owner must be a valid XRPL account address');
108
+ }
109
+ // ── OfferSequence ── required, UInt32 (non-negative integer).
110
+ if (props.OfferSequence === undefined || props.OfferSequence === null) {
111
+ throw new ValidationError('EscrowFinish: OfferSequence is required');
112
+ }
113
+ if (!isUInt32(props.OfferSequence)) {
114
+ throw new ValidationError('EscrowFinish: OfferSequence must be a non-negative integer (UInt32)');
115
+ }
116
+ // ── Condition ── optional, hex string when present.
117
+ if (props.Condition !== undefined) {
118
+ if (!isString(props.Condition) || !isHex(props.Condition)) {
119
+ throw new ValidationError('EscrowFinish: Condition must be a hex string (PREIMAGE-SHA-256 crypto-condition)');
120
+ }
121
+ }
122
+ // ── Fulfillment ── optional, hex string when present.
123
+ if (props.Fulfillment !== undefined) {
124
+ if (!isString(props.Fulfillment) || !isHex(props.Fulfillment)) {
125
+ throw new ValidationError('EscrowFinish: Fulfillment must be a hex string (PREIMAGE-SHA-256 crypto-condition fulfillment)');
126
+ }
127
+ }
128
+ // ── CredentialIDs ── optional array, but bounds + entry-shape enforced
129
+ // when present. Per xrpl.js: length in [1, MAX_AUTHORIZED_CREDENTIALS];
130
+ // each entry is a 64-char hex string; no duplicates.
131
+ if (props.CredentialIDs !== undefined) {
132
+ if (!isArray(props.CredentialIDs)) {
133
+ throw new ValidationError('EscrowFinish: CredentialIDs must be an array of credential ID strings');
134
+ }
135
+ if (props.CredentialIDs.length === 0) {
136
+ throw new ValidationError('EscrowFinish: CredentialIDs must not be an empty array');
137
+ }
138
+ if (props.CredentialIDs.length > MAX_CREDENTIAL_IDS) {
139
+ throw new ValidationError(`EscrowFinish: CredentialIDs length cannot exceed ${MAX_CREDENTIAL_IDS} elements (actual: ${props.CredentialIDs.length})`);
140
+ }
141
+ const seen = new Set();
142
+ for (let i = 0; i < props.CredentialIDs.length; i++) {
143
+ const cid = props.CredentialIDs[i];
144
+ if (!isString(cid) || !isHex(cid) || cid.length !== CREDENTIAL_ID_LENGTH) {
145
+ throw new ValidationError(`EscrowFinish: CredentialIDs[${i}] must be a ${CREDENTIAL_ID_LENGTH}-character hex string`);
146
+ }
147
+ if (seen.has(cid)) {
148
+ throw new ValidationError(`EscrowFinish: CredentialIDs[${i}] is a duplicate of an earlier entry`);
149
+ }
150
+ seen.add(cid);
151
+ }
152
+ }
153
+ return buildFrozenTx('EscrowFinish', props, {
154
+ validate() {
155
+ // Validated at construction.
156
+ },
157
+ toJSON() {
158
+ const json = {};
159
+ for (const k of Object.keys(this)) {
160
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
161
+ continue;
162
+ const v = this[k];
163
+ if (v !== undefined)
164
+ json[k] = v;
165
+ }
166
+ return json;
167
+ },
168
+ with(overrides) {
169
+ return escrowFinish(mergeForWith(this, overrides));
170
+ },
171
+ });
172
+ }
173
+ //# sourceMappingURL=escrow-finish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escrow-finish.js","sourceRoot":"","sources":["../../../src/fp/factories/escrow-finish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,6DAA6D;AAC7D,oDAAoD;AACpD,oCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,uEAAuE;AACvE,MAAM,oBAAoB,GAAG,EAAE,CAAC;AA2ChC,wEAAwE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,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAClB,cAAc,EACd,KAAK,EACL;QACE,QAAQ;YACN,6BAA6B;QAC/B,CAAC;QACD,MAAM;YACJ,MAAM,IAAI,GAA4B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,MAAM;oBAAE,SAAS;gBACjE,MAAM,CAAC,GAAI,IAA2C,CAAC,CAAC,CAAC,CAAC;gBAC1D,IAAI,CAAC,KAAK,SAAS;oBAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAqB,SAAqC;YAC5D,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACrD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface LedgerStateFixProps {
2
+ /** Sender. Classic or X-address. */
3
+ Account: string;
4
+ /**
5
+ * The type of fix to apply. UInt16 (0..65535). Currently only `1` is
6
+ * defined (NFToken-page-links fix); other values yield
7
+ * `tefINVALID_LEDGER_FIX_TYPE` at apply time.
8
+ */
9
+ LedgerFixType: number;
10
+ /**
11
+ * The account whose ledger entry needs fixing. Required when
12
+ * `LedgerFixType === 1` (the NFToken-page-links fix); optional
13
+ * otherwise. Classic or X-address. Does not need to match `Account`.
14
+ */
15
+ Owner?: string | undefined;
16
+ /**
17
+ * Fee in drops. Must be ≥ 2,000,000 (owner reserve for one item)
18
+ * per the Special Transaction Cost rule. Required for submission.
19
+ */
20
+ Fee?: string | undefined;
21
+ /** Account sequence. Required for submission. */
22
+ Sequence?: number | undefined;
23
+ }
24
+ export interface LedgerStateFix extends Readonly<LedgerStateFixProps> {
25
+ readonly TransactionType: 'LedgerStateFix';
26
+ validate(): void;
27
+ toJSON(): Record<string, unknown>;
28
+ with(overrides: Partial<LedgerStateFixProps>): LedgerStateFix;
29
+ }
30
+ export declare function ledgerStateFix(props: LedgerStateFixProps): LedgerStateFix;
31
+ //# sourceMappingURL=ledger-state-fix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger-state-fix.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/ledger-state-fix.ts"],"names":[],"mappings":"AAoGA,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,cACf,SAAQ,QAAQ,CAAC,mBAAmB,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC3C,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,cAAc,CAAC;CAC/D;AAID,wBAAgB,cAAc,CAC5B,KAAK,EAAE,mBAAmB,GACzB,cAAc,CAgGhB"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Functional LedgerStateFix factory — frozen-object style.
3
+ *
4
+ * `LedgerStateFix` is an internal, amendment-gated transaction used by
5
+ * the network itself to repair corruptions to ledger state. It was
6
+ * introduced by the `fixNFTokenPageLinks` amendment to repair broken
7
+ * links in NFToken directories; the type is extensible so that future
8
+ * fixes can be added with new `LedgerFixType` values.
9
+ *
10
+ * Users rarely submit these, but the factory validates the shape so any
11
+ * tooling that emits one cannot produce a malformed wire format.
12
+ *
13
+ * import { ledgerStateFix } from 'xrplt/fp';
14
+ * const tx = ledgerStateFix({
15
+ * Account,
16
+ * LedgerFixType: 1,
17
+ * Owner, // the account whose NFToken directory needs fixing
18
+ * Fee: '2000000',
19
+ * Sequence: 2,
20
+ * });
21
+ * const j = tx.toJSON();
22
+ *
23
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/ledgerstatefix
24
+ * @see https://xrpl.org/resources/known-amendments#fixnftokenpagelinks
25
+ *
26
+ * Affected amendment:
27
+ * - `fixNFTokenPageLinks` — introduces `LedgerStateFix` and the only
28
+ * currently-defined `LedgerFixType` (value `1`, fix an NFToken
29
+ * directory's missing page link).
30
+ *
31
+ * ## Divergences
32
+ *
33
+ * The class-based API at `src/transactions/ledger-state-fix.ts` has an
34
+ * empty `ASSIGNABLE_FIELDS` list and accepts any props blindly through
35
+ * `applyManifest`. It does not validate any field, so the factory fills
36
+ * every spec guard here:
37
+ *
38
+ * 1. `LedgerFixType` is a `UInt16` (0..65535).
39
+ * The class accepts any value (including strings, negative numbers,
40
+ * out-of-range numbers). The binary serialization rejects
41
+ * `LedgerFixType` outside UInt16 with `temMALFORMED`, and an
42
+ * undefined value triggers `tefINVALID_LEDGER_FIX_TYPE`.
43
+ * Source: xrpl-dev-portal `docs/references/protocol/transactions/
44
+ * types/ledgerstatefix.md` (Field table: UInt16;
45
+ * Error Cases: `tefINVALID_LEDGER_FIX_TYPE`);
46
+ * xrpl.js `ripple-binary-codec/src/enums/definitions.json`
47
+ * (`"LedgerStateFix": [{ "name": "LedgerFixType",
48
+ * "optionality": 0 }]`).
49
+ *
50
+ * 2. `Owner` is required when `LedgerFixType === 1`.
51
+ * The class has no field for `Owner` and skips this check. The
52
+ * spec mandates `Owner` for type 1 (the NFToken-page-links fix);
53
+ * missing it yields `temMALFORMED`.
54
+ * Source: xrpl-dev-portal `docs/references/protocol/transactions/
55
+ * types/ledgerstatefix.md` (Field table row for `Owner`:
56
+ * "_Required if LedgerFixType is 1._").
57
+ *
58
+ * 3. `Fee` must meet the special transaction cost (≥ owner reserve).
59
+ * The class has no fee guard. The docs explicitly state that this
60
+ * transaction type "must pay a special transaction cost equal to
61
+ * at least the owner reserve for one item (currently 2,000,000
62
+ * drops)". The fee is charged even when the transaction fails, so
63
+ * submitting with a too-low fee wastes the included transactions
64
+ * that run alongside (e.g. in a Batch).
65
+ * Source: xrpl-dev-portal `docs/references/protocol/transactions/
66
+ * types/ledgerstatefix.md` (Special Transaction Cost
67
+ * section; example JSON shows `Fee: "2000000"`);
68
+ * xrpl-dev-portal `docs/references/protocol/data-types/
69
+ * basic-data-types.md` (owner reserve: 2 XRP = 2,000,000
70
+ * drops).
71
+ *
72
+ * 4. `Account` must be a valid XRPL classic address.
73
+ * The class passes any string through. The binary codec rejects
74
+ * malformed addresses with `temMALFORMED`.
75
+ * Source: xrpl-dev-portal `docs/references/protocol/transactions/
76
+ * types/ledgerstatefix.md` (Example JSON uses
77
+ * `rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn` — classic address
78
+ * form).
79
+ *
80
+ * Note: `BookDirectory` appears in the xrpl.js binary definitions
81
+ * (`{"name": "BookDirectory", "optionality": 1}`) but is not part of
82
+ * the user-facing transaction reference for any documented
83
+ * `LedgerFixType`. It is reserved for future fix types and is not
84
+ * exposed on the factory interface.
85
+ */
86
+ import { isAccount, isNumber, isString } from '../../validation/helpers.js';
87
+ import { ValidationError } from '../../errors.js';
88
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
89
+ // ─── Spec constants ──────────────────────────────────────────────────
90
+ /** Minimum `Fee` for a LedgerStateFix per the Special Transaction Cost rule. */
91
+ const MIN_FEE_DROPS = 2_000_000; // 2 XRP = owner reserve for one item
92
+ /** `LedgerFixType` is a UInt16 per the binary serialization. */
93
+ const LEDGER_FIX_TYPE_MAX = 0xffff;
94
+ /** The only documented fix type (NFToken-page-links). */
95
+ const LEDGER_FIX_TYPE_NFTOKEN_PAGE_LINKS = 1;
96
+ // ─── Factory ─────────────────────────────────────────────────────────
97
+ export function ledgerStateFix(props) {
98
+ // ── Account ── required, must be a valid XRPL classic or X-address.
99
+ require(props.Account, 'LedgerStateFix: Account is required', isString);
100
+ if (!isAccount(props.Account)) {
101
+ throw new ValidationError('LedgerStateFix: Account must be a valid XRPL classic or X-address');
102
+ }
103
+ // ── LedgerFixType ── required, UInt16.
104
+ require(props.LedgerFixType, 'LedgerStateFix: LedgerFixType is required (UInt16, currently only 1 is defined)', isNumber);
105
+ if (!Number.isInteger(props.LedgerFixType) ||
106
+ props.LedgerFixType < 0 ||
107
+ props.LedgerFixType > LEDGER_FIX_TYPE_MAX) {
108
+ throw new ValidationError(`LedgerStateFix: LedgerFixType must be an integer in [0, ${LEDGER_FIX_TYPE_MAX}] (UInt16)`);
109
+ }
110
+ // ── Owner ── required iff LedgerFixType === 1.
111
+ if (props.LedgerFixType === LEDGER_FIX_TYPE_NFTOKEN_PAGE_LINKS) {
112
+ if (props.Owner === undefined) {
113
+ throw new ValidationError('LedgerStateFix: Owner is required when LedgerFixType === 1 (NFToken-page-links fix)');
114
+ }
115
+ }
116
+ if (props.Owner !== undefined) {
117
+ if (!isString(props.Owner)) {
118
+ throw new ValidationError('LedgerStateFix: Owner must be a string address');
119
+ }
120
+ if (!isAccount(props.Owner)) {
121
+ throw new ValidationError('LedgerStateFix: Owner must be a valid XRPL classic or X-address');
122
+ }
123
+ }
124
+ // ── Fee ── Special Transaction Cost: ≥ owner reserve.
125
+ // The fee is charged even on failure, so an under-funded submit burns
126
+ // its place in any containing Batch.
127
+ if (props.Fee !== undefined) {
128
+ if (!isString(props.Fee) || !/^[0-9]+$/u.test(props.Fee)) {
129
+ throw new ValidationError('LedgerStateFix: Fee must be a base-10 string of drops');
130
+ }
131
+ if (BigInt(props.Fee) < BigInt(MIN_FEE_DROPS)) {
132
+ throw new ValidationError(`LedgerStateFix: Fee must be ≥ ${MIN_FEE_DROPS} drops (Special Transaction Cost = owner reserve for one item)`);
133
+ }
134
+ }
135
+ // ── Sequence ── integer ≥ 0.
136
+ if (props.Sequence !== undefined) {
137
+ if (!isNumber(props.Sequence) ||
138
+ !Number.isInteger(props.Sequence) ||
139
+ props.Sequence < 0) {
140
+ throw new ValidationError('LedgerStateFix: Sequence must be a non-negative integer');
141
+ }
142
+ }
143
+ return buildFrozenTx('LedgerStateFix', props, {
144
+ validate() {
145
+ // Validated at construction.
146
+ },
147
+ toJSON() {
148
+ const json = {};
149
+ for (const k of Object.keys(this)) {
150
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
151
+ continue;
152
+ const v = this[k];
153
+ if (v !== undefined)
154
+ json[k] = v;
155
+ }
156
+ return json;
157
+ },
158
+ with(overrides) {
159
+ return ledgerStateFix(mergeForWith(this, overrides));
160
+ },
161
+ });
162
+ }
163
+ //# sourceMappingURL=ledger-state-fix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger-state-fix.js","sourceRoot":"","sources":["../../../src/fp/factories/ledger-state-fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,gFAAgF;AAChF,MAAM,aAAa,GAAG,SAAS,CAAC,CAAC,qCAAqC;AACtE,gEAAgE;AAChE,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,yDAAyD;AACzD,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAoC7C,wEAAwE;AAExE,MAAM,UAAU,cAAc,CAC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