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,203 @@
1
+ /**
2
+ * Functional ConfidentialMptConvertBack factory — frozen-object style.
3
+ *
4
+ * Converts a holder's confidential (encrypted) MPT spending balance back
5
+ * into a public balance. The plaintext `MPTAmount` is credited to the
6
+ * holder's public balance, while the ciphertext pair is homomorphically
7
+ * subtracted from the holder's spending balance and the issuer's mirror
8
+ * balance. Issuers may also use this transaction from their dedicated
9
+ * second account to return confidential supply to public form.
10
+ *
11
+ * Validation happens at construction; there is no way to construct an
12
+ * invalid tx. Compare to the class-based equivalent, which exposes a
13
+ * separate `.validate()` method you must remember to call.
14
+ *
15
+ * import { confidentialMptConvertBack } from 'xrplt/fp';
16
+ * const tx = confidentialMptConvertBack({
17
+ * Account,
18
+ * MPTokenIssuanceID,
19
+ * MPTAmount,
20
+ * HolderEncryptedAmount,
21
+ * IssuerEncryptedAmount,
22
+ * BlindingFactor,
23
+ * BalanceCommitment,
24
+ * ZKProof,
25
+ * });
26
+ * const j = tx.toJSON();
27
+ * const tx2 = tx.with({ Fee: '100' });
28
+ *
29
+ * Requires the `ConfidentialTransfer` amendment.
30
+ *
31
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/confidentialmptconvertback
32
+ * @see XLS-0096 §11 — Transaction: `ConfidentialMPTConvertBack`
33
+ * (https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0096-confidential-mpt)
34
+ * @see xrpl.js — packages/xrpl/src/models/transactions/ConfidentialMPTConvertBack.ts
35
+ *
36
+ * ## Divergences
37
+ *
38
+ * Compared with `src/transactions/confidential-mpt-convert-back.ts`, this
39
+ * factory adds guards the class skips — and is explicit about the
40
+ * canonical guards it cannot enforce in a zero-dependency package.
41
+ *
42
+ * - **`Account` is validated as a well-formed XRPL classic or X-address**
43
+ * at construction time, with `isAccount` (`src/validation/helpers.ts`
44
+ * lines 55–60). The class API delegates Account validation to its
45
+ * `TokenTransaction` → `Transaction` parent chain via `super.validate()`;
46
+ * failures therefore surface as a separate `.validate()` step rather
47
+ * than at `new`. We re-implement the guard inline so a malformed Account
48
+ * is caught at construction.
49
+ * - Source: xrpl.js `validateBaseTransaction` (called transitively by
50
+ * `validateConfidentialMPTConvertBack`).
51
+ * - Source: xrpl-dev-portal `confidentialmptconvertback.md` JSON-Type
52
+ * column for `Account` (`ACCOUNTID`).
53
+ *
54
+ * - **`MPTokenIssuanceID` is required to be exactly 48 hex characters
55
+ * at construction time** (XLS-0096 §11.3 declares `MPTokenIssuanceID`
56
+ * as `UINT192`; xrpl-dev-portal `confidentialmptconvertback.md`
57
+ * declares the same). The class does the same check via `isHex` +
58
+ * `length !== 48`, but only inside `.validate()` rather than at `new`.
59
+ * - Source: XLS-0096 §11.3 Fields table, Internal Type = `UINT192`.
60
+ * - Source: xrpl-dev-portal `confidentialmptconvertback.md` Fields
61
+ * table row for `MPTokenIssuanceID`.
62
+ *
63
+ * - **`MPTAmount` is bounded to the canonical UInt64 range and rejected
64
+ * for non-numeric / non-integer / out-of-range form.** The class only
65
+ * checks `MPTAmount === '0'`, allowing `'9223372036854775808'` (one
66
+ * past max uint64) to pass through and rely on the ledger to reject
67
+ * it. xrpl.js's `validateConfidentialMPTAmount` (called via
68
+ * `validateConfidentialMPTConvertBack` with `allowZero = false`)
69
+ * enforces both `INTEGER_SANITY_CHECK` (`/^[0-9]+$/u`) and
70
+ * `MPTAmount <= MAX_MPT_AMOUNT (= 9223372036854775807)`.
71
+ * - Source: xrpl.js `validateConfidentialMPTAmount`
72
+ * (`packages/xrpl/src/models/transactions/common.ts` lines 596–608).
73
+ * - Source: xrpl.js `MAX_MPT_AMOUNT` (same file, line 48).
74
+ * - Source: xrpl.js `ConfidentialMPTConvertBack.ts` line 83:
75
+ * `validateConfidentialMPTAmount(tx, false)` (allowZero=false).
76
+ * - Source: XLS-0096 §11.5.1 item 4: `MPTAmount` is zero or exceeds
77
+ * the maximum allowable supply → `temBAD_AMOUNT`.
78
+ *
79
+ * - **`Account` must NOT be the issuer of `MPTokenIssuanceID` (KNOWN
80
+ * LIMITATION — NOT IMPLEMENTED)**. XLS-0096 §11.5.1.2 mandates this
81
+ * as `temMALFORMED`:
82
+ *
83
+ * > "The account submitting the transaction is the Issuer.
84
+ * > (`temMALFORMED`)"
85
+ *
86
+ * xrpl.js's `validateConfidentialMPTConvertBack` (lines 78–82)
87
+ * enforces this via its `isMPTIssuer(account, mptIssuanceID)` helper,
88
+ * which calls `decodeAccountID` (base58 + double-SHA-256 checksum
89
+ * decoding of the classic address) and compares the resulting 20-byte
90
+ * AccountID against `mptIssuanceID.slice(8)` (the 40-hex-char issuer
91
+ * portion after the 8-hex-char sequence prefix).
92
+ *
93
+ * This factory cannot add this guard because the package is
94
+ * **zero-dependency** — base58 + checksum decoding would require
95
+ * either inlining a ~50-line codec or pulling in
96
+ * `ripple-address-codec`, neither of which fits the scope of a
97
+ * single-tx factory. The class API also skips this guard (it relies
98
+ * on `super.validate()` which does not perform the issuer check), so
99
+ * this is not a coverage regression relative to the class — but it
100
+ * remains a documented gap that consumers must validate at the
101
+ * integration layer (e.g. via the ledger submission result).
102
+ * - Source: XLS-0096 §11.5.1.2 Failure Conditions (Data Verification),
103
+ * item 2: `temMALFORMED` when `Account` is the Issuer.
104
+ * - Source: xrpl-dev-portal `confidentialmptconvertback.md` Error
105
+ * Cases table, `temMALFORMED` row.
106
+ * - Source: xrpl.js `ConfidentialMPTConvertBack.ts` lines 78–82
107
+ * (`isMPTIssuer` guard) and `common.ts` lines 632–646
108
+ * (`isMPTIssuer` implementation, including the base58 + AccountID
109
+ * decoding dependency).
110
+ */
111
+ import { isAccount, isHex, isString } from '../../validation/helpers.js';
112
+ import { ValidationError } from '../../errors.js';
113
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
114
+ // ─── Spec constants ──────────────────────────────────────────────────
115
+ // `MPTokenIssuanceID` is a `UINT192`, hex-encoded to exactly 48 chars
116
+ // (192 / 8 = 24 bytes = 48 hex chars). XLS-0096 §11.3; xrpl-dev-portal
117
+ // `confidentialmptconvertback.md` Fields table.
118
+ const MPT_ISSUANCE_ID_HEX_LENGTH = 48;
119
+ // ElGamal ciphertext = 2 compressed points = 66 bytes = 132 hex chars.
120
+ // XLS-0096 §11.3; xrpl.js `CONFIDENTIAL_ELGAMAL_CIPHERTEXT_BYTES = 66`.
121
+ const ELGAMAL_CIPHERTEXT_HEX_LENGTH = 132;
122
+ // `BlindingFactor` is `UINT256` = 32 bytes = 64 hex chars.
123
+ // XLS-0096 §11.3; xrpl.js `CONFIDENTIAL_BLINDING_FACTOR_BYTES = 32`.
124
+ const BLINDING_FACTOR_HEX_LENGTH = 64;
125
+ // Pedersen commitment = 1 compressed point = 33 bytes = 66 hex chars.
126
+ // XLS-0096 §11.3; xrpl.js `CONFIDENTIAL_EC_POINT_BYTES = 33`.
127
+ const BALANCE_COMMITMENT_HEX_LENGTH = 66;
128
+ // `ZKProof` for ConvertBack is 816 bytes = 1632 hex chars
129
+ // (128 bytes compact sigma + 688 bytes single Bulletproof range proof).
130
+ // XLS-0096 §11.3 + §11 "Proof Structure"; xrpl.js
131
+ // `CONFIDENTIAL_CONVERT_BACK_PROOF_BYTES = 816`.
132
+ const ZK_PROOF_HEX_LENGTH = 1632;
133
+ // `MPTAmount` is a `UINT64` per XLS-0096 §11.3. The maximum is 2^63 − 1
134
+ // (signed integer range), matching xrpl.js's `MAX_MPT_AMOUNT`. Integer
135
+ // form is required (no decimals, no leading sign) per xrpl.js
136
+ // `INTEGER_SANITY_CHECK = /^[0-9]+$/u`. Zero is forbidden for
137
+ // ConvertBack (only Convert allows zero).
138
+ const MAX_MPT_AMOUNT = BigInt('9223372036854775807');
139
+ const INTEGER_SANITY_CHECK = /^[0-9]+$/u;
140
+ // ─── Helpers ─────────────────────────────────────────────────────────
141
+ function requireHexOfLength(value, fieldName, hexLength) {
142
+ if (!isString(value) || !isHex(value) || value.length !== hexLength) {
143
+ throw new ValidationError(`ConfidentialMPTConvertBack: ${fieldName} must be a ${hexLength}-character hex string (${hexLength / 2} bytes)`);
144
+ }
145
+ }
146
+ // ─── Factory ─────────────────────────────────────────────────────────
147
+ export function confidentialMptConvertBack(props) {
148
+ // ── Account ── required, must be a valid XRPL classic/X-address.
149
+ require(props.Account, 'ConfidentialMPTConvertBack: Account is required', isAccount);
150
+ // ── MPTokenIssuanceID ── required, exactly 48-char hex (UINT192).
151
+ requireHexOfLength(props.MPTokenIssuanceID, 'MPTokenIssuanceID', MPT_ISSUANCE_ID_HEX_LENGTH);
152
+ // ── MPTAmount ── required, non-empty integer string, in [1, 2^63-1].
153
+ if (!isString(props.MPTAmount)) {
154
+ throw new ValidationError('ConfidentialMPTConvertBack: MPTAmount is required');
155
+ }
156
+ if (!INTEGER_SANITY_CHECK.test(props.MPTAmount)) {
157
+ throw new ValidationError('ConfidentialMPTConvertBack: MPTAmount must be a non-negative base-10 integer string');
158
+ }
159
+ const amount = BigInt(props.MPTAmount);
160
+ if (amount === BigInt(0)) {
161
+ throw new ValidationError('ConfidentialMPTConvertBack: MPTAmount must be non-zero');
162
+ }
163
+ if (amount > MAX_MPT_AMOUNT) {
164
+ throw new ValidationError(`ConfidentialMPTConvertBack: MPTAmount out of range (max ${MAX_MPT_AMOUNT.toString()})`);
165
+ }
166
+ // ── HolderEncryptedAmount ── required, 132-char hex (66-byte ElGamal ciphertext).
167
+ requireHexOfLength(props.HolderEncryptedAmount, 'HolderEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LENGTH);
168
+ // ── IssuerEncryptedAmount ── required, 132-char hex (66-byte ElGamal ciphertext).
169
+ requireHexOfLength(props.IssuerEncryptedAmount, 'IssuerEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LENGTH);
170
+ // ── BlindingFactor ── required, 64-char hex (32-byte scalar).
171
+ requireHexOfLength(props.BlindingFactor, 'BlindingFactor', BLINDING_FACTOR_HEX_LENGTH);
172
+ // ── BalanceCommitment ── required, 66-char hex (33-byte Pedersen commitment).
173
+ requireHexOfLength(props.BalanceCommitment, 'BalanceCommitment', BALANCE_COMMITMENT_HEX_LENGTH);
174
+ // ── ZKProof ── required, 1632-char hex (816-byte ConvertBack proof bundle).
175
+ requireHexOfLength(props.ZKProof, 'ZKProof', ZK_PROOF_HEX_LENGTH);
176
+ // ── AuditorEncryptedAmount ── optional, 132-char hex (66-byte ElGamal ciphertext).
177
+ if (props.AuditorEncryptedAmount !== undefined) {
178
+ requireHexOfLength(props.AuditorEncryptedAmount, 'AuditorEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LENGTH);
179
+ }
180
+ // NOTE: `Account` must NOT be the issuer of `MPTokenIssuanceID`
181
+ // (XLS-0096 §11.5.1.2 / xrpl.js `isMPTIssuer` guard). Not enforced
182
+ // here — see `## Divergences` header for why.
183
+ return buildFrozenTx('ConfidentialMPTConvertBack', props, {
184
+ validate() {
185
+ // Validated at construction.
186
+ },
187
+ toJSON() {
188
+ const json = {};
189
+ for (const k of Object.keys(this)) {
190
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
191
+ continue;
192
+ const v = this[k];
193
+ if (v !== undefined)
194
+ json[k] = v;
195
+ }
196
+ return json;
197
+ },
198
+ with(overrides) {
199
+ return confidentialMptConvertBack(mergeForWith(this, overrides));
200
+ },
201
+ });
202
+ }
203
+ //# sourceMappingURL=confidential-mpt-convert-back.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidential-mpt-convert-back.js","sourceRoot":"","sources":["../../../src/fp/factories/confidential-mpt-convert-back.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,sEAAsE;AACtE,uEAAuE;AACvE,gDAAgD;AAChD,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,uEAAuE;AACvE,wEAAwE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,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,CAEF,SAAmD;YAEnD,OAAO,0BAA0B,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACnE,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,32 @@
1
+ export interface ConfidentialMptConvertProps {
2
+ /** The account performing the conversion. Must be a valid XRPL classic/X-address. */
3
+ Account: string;
4
+ /** UInt192 — MPT issuance identifier (48-char hex). */
5
+ MPTokenIssuanceID: string;
6
+ /** UInt64 — plaintext public amount to convert (base-10 integer string, ≤ 2⁶³−1). */
7
+ MPTAmount: string;
8
+ /** 33-byte compressed ElGamal EC point (66 hex chars). Optional; required on first opt-in. */
9
+ HolderEncryptionKey?: string | undefined;
10
+ /** 66-byte ElGamal ciphertext credited to the holder's inbox (132 hex chars). */
11
+ HolderEncryptedAmount: string;
12
+ /** 66-byte ElGamal ciphertext credited to the issuer mirror balance (132 hex chars). */
13
+ IssuerEncryptedAmount: string;
14
+ /** 66-byte ElGamal ciphertext for the auditor (132 hex chars). Required when issuance has AuditorEncryptionKey. */
15
+ AuditorEncryptedAmount?: string | undefined;
16
+ /** UInt256 — 32-byte scalar blinding factor (64 hex chars). */
17
+ BlindingFactor: string;
18
+ /** 64-byte Schnorr proof of knowledge (128 hex chars). Required iff HolderEncryptionKey is present. */
19
+ ZKProof?: string | undefined;
20
+ /** Fee in XRP (drops), base-10 integer string. */
21
+ Fee?: string | undefined;
22
+ /** Account sequence number. */
23
+ Sequence?: number | undefined;
24
+ }
25
+ export interface ConfidentialMptConvert extends Readonly<ConfidentialMptConvertProps> {
26
+ readonly TransactionType: 'ConfidentialMPTConvert';
27
+ validate(): void;
28
+ toJSON(): Record<string, unknown>;
29
+ with(overrides: Partial<ConfidentialMptConvertProps>): ConfidentialMptConvert;
30
+ }
31
+ export declare function confidentialMptConvert(props: ConfidentialMptConvertProps): ConfidentialMptConvert;
32
+ //# sourceMappingURL=confidential-mpt-convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidential-mpt-convert.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/confidential-mpt-convert.ts"],"names":[],"mappings":"AAsJA,MAAM,WAAW,2BAA2B;IAC1C,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,iFAAiF;IACjF,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wFAAwF;IACxF,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mHAAmH;IACnH,sBAAsB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,sBACf,SAAQ,QAAQ,CAAC,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,eAAe,EAAE,wBAAwB,CAAC;IACnD,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,2BAA2B,CAAC,GAAG,sBAAsB,CAAC;CAC/E;AAkBD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,sBAAsB,CAgHxB"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Functional ConfidentialMPTConvert factory — frozen-object style.
3
+ *
4
+ * Converts a holder's public MPT balance to a confidential balance (credited
5
+ * to the holder's inbox; merge via `ConfidentialMPTMergeInbox` to make it
6
+ * spendable). Also serves as the **opt-in mechanism** for confidential
7
+ * transfer participation: a zero-amount conversion registers the holder's
8
+ * `HolderEncryptionKey` on their `MPToken` object.
9
+ *
10
+ * Validation happens at construction; there is no way to construct an
11
+ * invalid tx. Compare to the class-based equivalent, which exposes a
12
+ * separate `.validate()` method you must remember to call.
13
+ *
14
+ * import { confidentialMptConvert } from 'xrplt/fp';
15
+ * const tx = confidentialMptConvert({
16
+ * Account, MPTokenIssuanceID, MPTAmount: '0',
17
+ * HolderEncryptionKey, HolderEncryptedAmount, IssuerEncryptedAmount,
18
+ * BlindingFactor, ZKProof,
19
+ * });
20
+ *
21
+ * Requires the `ConfidentialTransfer` amendment.
22
+ *
23
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/confidentialmptconvert
24
+ * @see XLS-0096 §8 — Transaction: `ConfidentialMPTConvert`
25
+ * (https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0096-confidential-mpt)
26
+ * @see xrpl.js — packages/xrpl/src/models/transactions/ConfidentialMPTConvert.ts
27
+ *
28
+ * ## Divergences
29
+ *
30
+ * Compared with `src/transactions/confidential-mpt-convert.ts`, this
31
+ * factory adds guards the class skips — and documents the canonical
32
+ * guard that cannot be added in a zero-dependency package.
33
+ *
34
+ * - **`Account` is validated as a well-formed XRPL classic or X-address**
35
+ * at construction time, with `isAccount` (`src/validation/helpers.ts`
36
+ * lines 55–60). The class API delegates Account validation to its
37
+ * `TokenTransaction` → `Transaction` parent chain via
38
+ * `super.validate()`; failures therefore surface as a separate
39
+ * `.validate()` step rather than at `new`. We re-implement the
40
+ * guard inline so a malformed Account is caught at construction.
41
+ * - Source: xrpl.js `validateBaseTransaction` (called transitively by
42
+ * `validateConfidentialMPTConvert`).
43
+ * - Source: xrpl-dev-portal `confidentialmptconvert.md` JSON-Type
44
+ * column for `Account` (`ACCOUNTID`).
45
+ *
46
+ * - **`MPTAmount` is validated as a non-negative base-10 uint64 string
47
+ * ≤ 2⁶³−1, with `0` permitted** (XLS-0096 §8.4.1.8 declares
48
+ * over-max as `temBAD_AMOUNT`; a zero-amount convert is explicitly
49
+ * used to register the holder key per §8.1). The class accepts the
50
+ * field as-is with no range or well-formedness check.
51
+ * - Source: XLS-0096 §8.2 Fields table, Internal Type = `UINT64`.
52
+ * - Source: XLS-0096 §8.4.1.8 Failure Conditions, `temBAD_AMOUNT`.
53
+ * - Source: xrpl.js `validateConfidentialMPTAmount(tx, true)`
54
+ * (`packages/xrpl/src/models/transactions/common.ts` lines 596–608)
55
+ * which uses `MAX_MPT_AMOUNT = 2^63 − 1` and `INTEGER_SANITY_CHECK`.
56
+ * - Source: xrpl-dev-portal `confidentialmptconvert.md` Error Cases,
57
+ * `temBAD_AMOUNT` row.
58
+ *
59
+ * - **`HolderEncryptionKey` length is enforced to exactly 33 bytes
60
+ * (66 hex chars)** when present (XLS-0096 §8.4.1.5 declares
61
+ * `temMALFORMED` for any other length). The class only verifies
62
+ * `isHex` and that the length is non-zero, so a 64-char Schnorr-like
63
+ * blob or a 32-char short pubkey would pass the class and be rejected
64
+ * by rippled with `temMALFORMED`.
65
+ * - Source: XLS-0096 §8.4.1.5 Failure Conditions, `temMALFORMED`.
66
+ * - Source: xrpl.js `isHexWithByteLength(CONFIDENTIAL_EC_POINT_BYTES)`
67
+ * where `CONFIDENTIAL_EC_POINT_BYTES = 33`
68
+ * (`packages/xrpl/src/models/transactions/common.ts` lines 35–43).
69
+ * - Source: xrpl-dev-portal `confidentialmptconvert.md` Error Cases,
70
+ * `temMALFORMED` row "The length of `HolderEncryptionKey` is not
71
+ * exactly 33 bytes."
72
+ *
73
+ * - **`ZKProof` without `HolderEncryptionKey` is rejected** (XLS-0096
74
+ * §8.4.1.4 — `temMALFORMED`). The class only enforces the forward
75
+ * direction ("if HolderEncryptionKey is present, ZKProof must be
76
+ * present"); the reverse case slips through the class and is rejected
77
+ * by rippled.
78
+ * - Source: XLS-0096 §8.4.1.4 Failure Conditions, `temMALFORMED`.
79
+ * - Source: xrpl.js `validateHolderKeyProofPairing`
80
+ * (`packages/xrpl/src/models/transactions/ConfidentialMPTConvert.ts`
81
+ * lines 73–79) checks both directions symmetrically with
82
+ * `(tx.HolderEncryptionKey == null) !== (tx.ZKProof == null)`.
83
+ *
84
+ * - **`Account` must NOT be the issuer of `MPTokenIssuanceID`
85
+ * (KNOWN LIMITATION — NOT IMPLEMENTED)**. XLS-0096 §8.4.1.2 mandates
86
+ * this as `temMALFORMED`:
87
+ *
88
+ * > "The `Account` is the Issuer of the `MPTokenIssuanceID`."
89
+ *
90
+ * xrpl.js enforces this via `isMPTIssuer(account, mptIssuanceID)`
91
+ * (`packages/xrpl/src/models/transactions/common.ts` lines 632–646),
92
+ * which calls `decodeAccountID` (base58 + double-SHA-256 checksum
93
+ * decoding of the classic address) and compares the resulting
94
+ * 20-byte AccountID against `mptIssuanceID.slice(8)` (the 40-hex-char
95
+ * issuer portion after the 8-hex-char sequence prefix).
96
+ *
97
+ * This factory cannot add this guard because the package is
98
+ * **zero-dependency** — base58 + checksum decoding would require
99
+ * either inlining a ~50-line codec or pulling in
100
+ * `ripple-address-codec`, neither of which fits the scope of a
101
+ * single-tx factory. The class API also skips this guard (it
102
+ * relies on `super.validate()` which does not perform the
103
+ * issuer check), so this is not a coverage regression relative
104
+ * to the class — but it remains a documented gap that consumers
105
+ * must validate at the integration layer (e.g. via the ledger
106
+ * submission result).
107
+ * - Source: XLS-0096 §8.4.1.2 Failure Conditions (Data Verification),
108
+ * item 2: `temMALFORMED` when `Account` is the Issuer.
109
+ * - Source: xrpl-dev-portal `confidentialmptconvert.md` Error
110
+ * Cases table, `temMALFORMED` row.
111
+ * - Source: xrpl.js `ConfidentialMPTConvert.ts` lines 94–98
112
+ * (`isMPTIssuer` guard).
113
+ */
114
+ import { isAccount, isHex, isString } from '../../validation/helpers.js';
115
+ import { ValidationError } from '../../errors.js';
116
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
117
+ // ─── Spec constants ──────────────────────────────────────────────────
118
+ // `MPTokenIssuanceID` is a `UINT192`, hex-encoded to exactly 48 chars
119
+ // (192 / 8 = 24 bytes = 48 hex chars). XLS-0096 §8.2; xrpl-dev-portal
120
+ // `confidentialmptconvert.md` Fields table.
121
+ const MPT_ISSUANCE_ID_HEX_LEN = 48;
122
+ // `HolderEncryptedAmount` / `IssuerEncryptedAmount` / `AuditorEncryptedAmount`
123
+ // are 66-byte ElGamal ciphertexts. XLS-0096 §8.2; xrpl.js
124
+ // `CONFIDENTIAL_ELGAMAL_CIPHERTEXT_BYTES = 66`.
125
+ const ELGAMAL_CIPHERTEXT_HEX_LEN = 132;
126
+ // `HolderEncryptionKey` is a 33-byte compressed ElGamal EC point.
127
+ // XLS-0096 §8.4.1.5; xrpl.js `CONFIDENTIAL_EC_POINT_BYTES = 33`.
128
+ const HOLDER_ENCRYPTION_KEY_HEX_LEN = 66;
129
+ // `BlindingFactor` is a `UINT256` (32 bytes = 64 hex chars). XLS-0096 §8.2;
130
+ // xrpl.js `CONFIDENTIAL_BLINDING_FACTOR_BYTES = 32`.
131
+ const BLINDING_FACTOR_HEX_LEN = 64;
132
+ // `ZKProof` is a 64-byte Schnorr Proof of Knowledge. XLS-0096 §8.4.1.6;
133
+ // xrpl.js `CONFIDENTIAL_CONVERT_PROOF_BYTES = 64`.
134
+ const ZK_PROOF_HEX_LEN = 128;
135
+ // `MPTAmount` is `UINT64`; per XLS-0096 §8.4.1.8 over-max returns
136
+ // `temBAD_AMOUNT`. Per XLS-0096 §8.1 a zero-amount convert is explicitly
137
+ // permitted to register the holder key. xrpl.js `MAX_MPT_AMOUNT` =
138
+ // 2^63 − 1 = 9_223_372_036_854_775_807.
139
+ const MAX_MPT_AMOUNT = BigInt('9223372036854775807');
140
+ const INTEGER_SANITY_CHECK = /^[0-9]+$/u;
141
+ // ─── Helpers ─────────────────────────────────────────────────────────
142
+ function requireHexOfLength(value, fieldName, hexLength) {
143
+ if (!isString(value) || !isHex(value) || value.length !== hexLength) {
144
+ throw new ValidationError(`ConfidentialMPTConvert: ${fieldName} must be a ${hexLength}-character hex string`);
145
+ }
146
+ }
147
+ // ─── Factory ─────────────────────────────────────────────────────────
148
+ export function confidentialMptConvert(props) {
149
+ // ── Account ── required, must be a valid XRPL classic/X-address.
150
+ require(props.Account, 'ConfidentialMPTConvert: Account is required', isAccount);
151
+ // ── MPTokenIssuanceID ── required, exactly 48-char hex (UINT192).
152
+ requireHexOfLength(props.MPTokenIssuanceID, 'MPTokenIssuanceID', MPT_ISSUANCE_ID_HEX_LEN);
153
+ // NOTE: `Account` must NOT be the issuer of `MPTokenIssuanceID`
154
+ // (XLS-0096 §8.4.1.2 / xrpl.js `isMPTIssuer` guard). Not enforced
155
+ // here — see `## Divergences` header for why.
156
+ // ── MPTAmount ── required, non-negative uint64 ≤ 2⁶³−1; zero is allowed.
157
+ if (!isString(props.MPTAmount) || !INTEGER_SANITY_CHECK.test(props.MPTAmount)) {
158
+ throw new ValidationError('ConfidentialMPTConvert: MPTAmount must be a non-negative base-10 integer string');
159
+ }
160
+ if (BigInt(props.MPTAmount) > MAX_MPT_AMOUNT) {
161
+ throw new ValidationError(`ConfidentialMPTConvert: MPTAmount exceeds maximum ${MAX_MPT_AMOUNT.toString()}`);
162
+ }
163
+ // ── HolderEncryptedAmount ── required, 66-byte ElGamal ciphertext.
164
+ requireHexOfLength(props.HolderEncryptedAmount, 'HolderEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LEN);
165
+ // ── IssuerEncryptedAmount ── required, 66-byte ElGamal ciphertext.
166
+ requireHexOfLength(props.IssuerEncryptedAmount, 'IssuerEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LEN);
167
+ // ── BlindingFactor ── required, 32-byte scalar (UINT256).
168
+ requireHexOfLength(props.BlindingFactor, 'BlindingFactor', BLINDING_FACTOR_HEX_LEN);
169
+ // ── HolderEncryptionKey / ZKProof pairing ──
170
+ //
171
+ // XLS-0096 §8.4.1.3–§8.4.1.6 mandates: the pair must be set together
172
+ // or not at all, and each must be exactly its declared byte length.
173
+ // Symmetric guard via `xor`-style presence check.
174
+ const hasHolderKey = props.HolderEncryptionKey !== undefined;
175
+ const hasZkProof = props.ZKProof !== undefined;
176
+ if (hasHolderKey !== hasZkProof) {
177
+ throw new ValidationError('ConfidentialMPTConvert: set HolderEncryptionKey and ZKProof together (both required when either is present)');
178
+ }
179
+ if (hasHolderKey) {
180
+ // 33-byte compressed ElGamal EC point.
181
+ requireHexOfLength(props.HolderEncryptionKey, 'HolderEncryptionKey', HOLDER_ENCRYPTION_KEY_HEX_LEN);
182
+ // 64-byte Schnorr Proof of Knowledge.
183
+ requireHexOfLength(props.ZKProof, 'ZKProof', ZK_PROOF_HEX_LEN);
184
+ }
185
+ // ── AuditorEncryptedAmount ── optional; 66-byte ElGamal ciphertext.
186
+ if (props.AuditorEncryptedAmount !== undefined) {
187
+ requireHexOfLength(props.AuditorEncryptedAmount, 'AuditorEncryptedAmount', ELGAMAL_CIPHERTEXT_HEX_LEN);
188
+ }
189
+ return buildFrozenTx('ConfidentialMPTConvert', props, {
190
+ validate() {
191
+ // Validated at construction.
192
+ },
193
+ toJSON() {
194
+ const json = {};
195
+ for (const k of Object.keys(this)) {
196
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
197
+ continue;
198
+ const v = this[k];
199
+ if (v !== undefined)
200
+ json[k] = v;
201
+ }
202
+ return json;
203
+ },
204
+ with(overrides) {
205
+ return confidentialMptConvert(mergeForWith(this, overrides));
206
+ },
207
+ });
208
+ }
209
+ //# sourceMappingURL=confidential-mpt-convert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidential-mpt-convert.js","sourceRoot":"","sources":["../../../src/fp/factories/confidential-mpt-convert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,sEAAsE;AACtE,sEAAsE;AACtE,4CAA4C;AAC5C,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,+EAA+E;AAC/E,0DAA0D;AAC1D,gDAAgD;AAChD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,kEAAkE;AAClE,iEAAiE;AACjE,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEzC,4EAA4E;AAC5E,qDAAqD;AACrD,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,wEAAwE;AACxE,mDAAmD;AACnD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,kEAAkE;AAClE,yEAAyE;AACzE,mEAAmE;AACnE,wCAAwC;AACxC,MAAM,cAAc,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACrD,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAqCzC,wEAAwE;AAExE,SAAS,kBAAkB,CACzB,KAAc,EACd,SAAiB,EACjB,SAAiB;IAEjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,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ergeInboxProps {
2
+ /** The account performing the merge. Must be a valid XRPL classic/X-address. */
3
+ Account: string;
4
+ /** UInt192 — MPT issuance identifier (48-char hex). */
5
+ MPTokenIssuanceID: string;
6
+ /** Fee in XRP (drops), base-10 integer string. */
7
+ Fee?: string | undefined;
8
+ /** Account sequence number. */
9
+ Sequence?: number | undefined;
10
+ }
11
+ export interface ConfidentialMptMergeInbox extends Readonly<ConfidentialMptMergeInboxProps> {
12
+ readonly TransactionType: 'ConfidentialMPTMergeInbox';
13
+ validate(): void;
14
+ toJSON(): Record<string, unknown>;
15
+ with(overrides: Partial<ConfidentialMptMergeInboxProps>): ConfidentialMptMergeInbox;
16
+ }
17
+ export declare function confidentialMptMergeInbox(props: ConfidentialMptMergeInboxProps): ConfidentialMptMergeInbox;
18
+ //# sourceMappingURL=confidential-mpt-merge-inbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidential-mpt-merge-inbox.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/confidential-mpt-merge-inbox.ts"],"names":[],"mappings":"AAqGA,MAAM,WAAW,8BAA8B;IAC7C,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,yBACf,SAAQ,QAAQ,CAAC,8BAA8B,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAC;IACtD,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CACF,SAAS,EAAE,OAAO,CAAC,8BAA8B,CAAC,GACjD,yBAAyB,CAAC;CAC9B;AAID,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,GACpC,yBAAyB,CA+C3B"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Functional ConfidentialMPTMergeInbox factory — frozen-object style.
3
+ *
4
+ * Merges the holder's pending confidential inbox balance into their
5
+ * spendable confidential balance for the named MPT issuance. Resets
6
+ * the inbox to canonical encrypted zero and increments the spending
7
+ * version, ensuring subsequent zero-knowledge proofs reference a
8
+ * stable spending balance.
9
+ *
10
+ * Validation happens at construction; there is no way to construct
11
+ * an invalid tx. Compare to the class-based equivalent, which exposes
12
+ * a separate `.validate()` method you must remember to call.
13
+ *
14
+ * import { confidentialMptMergeInbox } from 'xrplt/fp';
15
+ * const tx = confidentialMptMergeInbox({ Account, MPTokenIssuanceID });
16
+ * const j = tx.toJSON();
17
+ * const tx2 = tx.with({ Fee: '100' });
18
+ *
19
+ * Requires the `ConfidentialTransfer` amendment.
20
+ *
21
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/confidentialmptmergeinbox
22
+ * @see XLS-0096 §10 — Transaction: `ConfidentialMPTMergeInbox`
23
+ * (https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0096-confidential-mpt)
24
+ * @see xrpl.js — packages/xrpl/src/models/transactions/ConfidentialMPTMergeInbox.ts
25
+ *
26
+ * ## Divergences
27
+ *
28
+ * Compared with `src/transactions/confidential-mpt-merge-inbox.ts`,
29
+ * this factory adds guards the class skips — and is documented where
30
+ * additional canonical guards cannot be added in a zero-dependency
31
+ * package.
32
+ *
33
+ * - **`Account` is validated as a well-formed XRPL classic or X-address**
34
+ * at construction time, with `isAccount` (`src/validation/helpers.ts`
35
+ * lines 55–60). The class API delegates Account validation to its
36
+ * `TokenTransaction` → `Transaction` parent chain via
37
+ * `super.validate()`; failures therefore surface as a separate
38
+ * `.validate()` step rather than at `new`. We re-implement the
39
+ * guard inline so a malformed Account is caught at construction.
40
+ * - Source: xrpl.js `validateBaseTransaction` (called transitively by
41
+ * `validateConfidentialMPTMergeInbox`).
42
+ * - Source: xrpl-dev-portal `confidentialmptmergeinbox.md` JSON-Type
43
+ * column for `Account` (`ACCOUNTID`).
44
+ *
45
+ * - **`MPTokenIssuanceID` is required to be exactly 48 hex characters
46
+ * at construction time** (XLS-0096 §10.2 declares
47
+ * `MPTokenIssuanceID` as `UINT192`; xrpl-dev-portal
48
+ * `confidentialmptmergeinbox.md` declares the same). The class
49
+ * does the same check via `isHex` + `length !== 48`, but only
50
+ * inside `.validate()` rather than at `new`.
51
+ * - Source: XLS-0096 §10.2 Fields table, Internal Type = `UINT192`.
52
+ * - Source: xrpl-dev-portal `confidentialmptmergeinbox.md` Fields
53
+ * table row for `MPTokenIssuanceID`.
54
+ *
55
+ * - **`Account` must NOT be the issuer of `MPTokenIssuanceID`
56
+ * (KNOWN LIMITATION — NOT IMPLEMENTED)**. XLS-0096 §10.4.1.2
57
+ * mandates this as `temMALFORMED`:
58
+ *
59
+ * > "The account submitting the transaction is the Issuer.
60
+ * > (`temMALFORMED`)"
61
+ *
62
+ * xrpl.js's `validateConfidentialMPTMergeInbox`
63
+ * (`packages/xrpl/src/models/transactions/ConfidentialMPTMergeInbox.ts`
64
+ * lines 36–41) enforces this via its `isMPTIssuer(account, mptIssuanceID)`
65
+ * helper, which calls `decodeAccountID` (base58 + double-SHA-256
66
+ * checksum decoding of the classic address) and compares the
67
+ * resulting 20-byte AccountID against `mptIssuanceID.slice(8)` (the
68
+ * 40-hex-char issuer portion after the 8-hex-char sequence prefix).
69
+ *
70
+ * This factory cannot add this guard because the package is
71
+ * **zero-dependency** — base58 + checksum decoding would require
72
+ * either inlining a ~50-line codec or pulling in
73
+ * `ripple-address-codec`, neither of which fits the scope of a
74
+ * single-tx factory. The class API also skips this guard (it
75
+ * relies on `super.validate()` which does not perform the
76
+ * issuer check), so this is not a coverage regression relative
77
+ * to the class — but it remains a documented gap that consumers
78
+ * must validate at the integration layer (e.g. via the ledger
79
+ * submission result).
80
+ * - Source: XLS-0096 §10.4.1.2 Failure Conditions (Data Verification),
81
+ * item 2: `temMALFORMED` when `Account` is the Issuer.
82
+ * - Source: xrpl-dev-portal `confidentialmptmergeinbox.md` Error
83
+ * Cases table, `temMALFORMED` row.
84
+ * - Source: xrpl.js `ConfidentialMPTMergeInbox.ts` lines 36–41
85
+ * (`isMPTIssuer` guard) and `common.ts` lines 632–646
86
+ * (`isMPTIssuer` implementation, including the base58 + AccountID
87
+ * decoding dependency).
88
+ */
89
+ import { isAccount, isHex, isString } from '../../validation/helpers.js';
90
+ import { ValidationError } from '../../errors.js';
91
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
92
+ // ─── Spec constants ──────────────────────────────────────────────────
93
+ // `MPTokenIssuanceID` is a `UINT192`, hex-encoded to exactly 48 chars
94
+ // (192 / 8 = 24 bytes = 48 hex chars). XLS-0096 §10.2; xrpl-dev-portal
95
+ // `confidentialmptmergeinbox.md` Fields table.
96
+ const MPT_ISSUANCE_ID_HEX_LENGTH = 48;
97
+ // ─── Factory ─────────────────────────────────────────────────────────
98
+ export function confidentialMptMergeInbox(props) {
99
+ // ── Account ── required, must be a valid XRPL classic/X-address.
100
+ require(props.Account, 'ConfidentialMPTMergeInbox: Account is required', isAccount);
101
+ // ── MPTokenIssuanceID ── required, exactly 48-char hex (UINT192).
102
+ if (!isString(props.MPTokenIssuanceID) ||
103
+ !isHex(props.MPTokenIssuanceID) ||
104
+ props.MPTokenIssuanceID.length !== MPT_ISSUANCE_ID_HEX_LENGTH) {
105
+ throw new ValidationError(`ConfidentialMPTMergeInbox: MPTokenIssuanceID must be a ${MPT_ISSUANCE_ID_HEX_LENGTH}-character hex string (UInt192)`);
106
+ }
107
+ // NOTE: `Account` must NOT be the issuer of `MPTokenIssuanceID`
108
+ // (XLS-0096 §10.4.1.2 / xrpl.js `isMPTIssuer` guard). Not enforced
109
+ // here — see `## Divergences` header for why.
110
+ return buildFrozenTx('ConfidentialMPTMergeInbox', props, {
111
+ validate() {
112
+ // Validated at construction.
113
+ },
114
+ toJSON() {
115
+ const json = {};
116
+ for (const k of Object.keys(this)) {
117
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
118
+ continue;
119
+ const v = this[k];
120
+ if (v !== undefined)
121
+ json[k] = v;
122
+ }
123
+ return json;
124
+ },
125
+ with(overrides) {
126
+ return confidentialMptMergeInbox(mergeForWith(this, overrides));
127
+ },
128
+ });
129
+ }
130
+ //# sourceMappingURL=confidential-mpt-merge-inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confidential-mpt-merge-inbox.js","sourceRoot":"","sources":["../../../src/fp/factories/confidential-mpt-merge-inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,sEAAsE;AACtE,uEAAuE;AACvE,+CAA+C;AAC/C,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAyBtC,wEAAwE;AAExE,MAAM,UAAU,yBAAyB,CACvC,KAAqC;IAErC,kEAAkE;IAClE,OAAO,CACL,KAAK,CAAC,OAAO,EACb,gDAAgD,EAChD,SAAS,CACV,CAAC;IAEF,mEAAmE;IACnE,IACE,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC;QAClC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC;QAC/B,KAAK,CAAC,iBAAiB,CAAC,MAAM,KAAK,0BAA0B,EAC7D,CAAC;QACD,MAAM,IAAI,eAAe,CACvB,0DAA0D,0BAA0B,iCAAiC,CACtH,CAAC;IACJ,CAAC;IAED,gEAAgE;IAChE,mEAAmE;IACnE,8CAA8C;IAE9C,OAAO,a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