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,206 @@
1
+ /**
2
+ * Functional XChainAddClaimAttestation factory — frozen-object style.
3
+ *
4
+ * Provides a witness-server attestation that an `XChainCommit`
5
+ * transaction occurred on the source chain. The witness signs a message
6
+ * that names the destination chain account (`Destination`), the source
7
+ * chain account (`OtherChainSource`), the amount, and which side of the
8
+ * bridge the commit happened on (`WasLockingChainSend`).
9
+ *
10
+ * import { xchainAddClaimAttestation } from 'xrplt/fp';
11
+ * const tx = xchainAddClaimAttestation({
12
+ * Account: ATTESTOR,
13
+ * Amount: '100000000',
14
+ * AttestationRewardAccount: REWARD,
15
+ * AttestationSignerAccount: SIGNER,
16
+ * Destination: 'r9A8UyNpW3X46FUc6P7JZqgn6WgAPjBwPg',
17
+ * OtherChainSource: 'rnJmYAiqEVngtnb5ckRroXLtCbWC7CRUBx',
18
+ * PublicKey: '03DAB289CA36FF377F3F4304C7A7203FDE5EDCBFC209F430F6A4355361425526D0',
19
+ * Signature: '616263',
20
+ * WasLockingChainSend: 1,
21
+ * XChainClaimID: '0000000000000000',
22
+ * XChainBridge: { ... },
23
+ * });
24
+ *
25
+ * Required amendment: `XChainBridge`.
26
+ *
27
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/xchainaddclaimattestation
28
+ * @see xrpl.js `packages/xrpl/src/models/transactions/XChainAddClaimAttestation.ts`
29
+ * (`validateXChainAddClaimAttestation` — source of every required-
30
+ * field check in this factory).
31
+ * @see XLS-0038 §2.3.3 — "The `XChainAddClaimAttestation` transaction"
32
+ * `~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
33
+ * lines 448–517 (Fields table at lines 462–473).
34
+ *
35
+ * ## Divergences
36
+ *
37
+ * The class-based API at
38
+ * `src/transactions/xchain-add-claim-attestation.ts` is missing several
39
+ * fields the canonical sources require AND exposes one field that is
40
+ * not in the spec at all. The factory corrects both:
41
+ *
42
+ * 1. **`AttestationRewardAccount` is required (XLS-38 §2.3.3.1.2).**
43
+ * The class does not declare this field. xrpl.js requires
44
+ * `validateRequiredField(tx, 'AttestationRewardAccount', isAccount)`
45
+ * (`XChainAddClaimAttestation.ts:92`); XRPL.org marks it as
46
+ * required (`xchainaddclaimattestation.md:79`); XLS-38 §2.3.3.1.2
47
+ * (line 465) describes it as "The account that should receive
48
+ * this signer's share of the `SignatureReward`." The factory
49
+ * requires it as a valid XRPL classic/X-address.
50
+ * Source: xrpl.js `XChainAddClaimAttestation.ts:92`;
51
+ * XRPL.org `xchainaddclaimattestation.md:79`;
52
+ * XLS-38 §2.3.3.1.2 (line 465).
53
+ *
54
+ * 2. **`AttestationSignerAccount` is required (XLS-38 §2.3.3.1.3).**
55
+ * The class does not declare this field. xrpl.js requires
56
+ * `validateRequiredField(tx, 'AttestationSignerAccount', isAccount)`
57
+ * (`XChainAddClaimAttestation.ts:94`); XRPL.org marks it as
58
+ * required (`xchainaddclaimattestation.md:80`); XLS-38 §2.3.3.1.3
59
+ * (line 466) describes it as "the account on the door account's
60
+ * signer list that is signing the transaction." The factory
61
+ * requires it as a valid XRPL classic/X-address.
62
+ * Source: xrpl.js `XChainAddClaimAttestation.ts:94`;
63
+ * XRPL.org `xchainaddclaimattestation.md:80`;
64
+ * XLS-38 §2.3.3.1.3 (line 466).
65
+ *
66
+ * 3. **`WasLockingChainSend` is the literal `0 | 1` union.** The
67
+ * class does not declare this field at all (its `ASSIGNABLE_FIELDS`
68
+ * list omits it). xrpl.js types it as `0 | 1` and validates with
69
+ * `(inp): inp is 0 | 1 => inp === 0 || inp === 1`
70
+ * (`XChainAddClaimAttestation.ts:65,104–108`). XRPL.org marks it
71
+ * `Number / UInt8` required (`xchainaddclaimattestation.md:85`);
72
+ * XLS-38 §2.3.3.1.8 (line 471) marks it required `UINT8`. The
73
+ * factory requires it and rejects anything other than `0` or `1`.
74
+ * Source: xrpl.js `XChainAddClaimAttestation.ts:65,104–108`;
75
+ * XRPL.org `xchainaddclaimattestation.md:85`;
76
+ * XLS-38 §2.3.3.1.8 (line 471).
77
+ *
78
+ * 4. **`XChainClaimID` accepts number OR string.** The class types the
79
+ * field as `number` only. xrpl.js types it as `number | string`
80
+ * (`XChainAddClaimAttestation.ts:76`) and validates with
81
+ * `isNumber(inp) || isString(inp)` (line 114). XRPL.org marks it
82
+ * `String / UInt64` internal type (`xchainaddclaimattestation.md:87`);
83
+ * XLS-38 §2.3.3.1.10 (line 473) defines it as `UINT64`. The wire
84
+ * format encodes UInt64 as a decimal string; callers frequently
85
+ * pass it as a string. The factory accepts either.
86
+ * Source: xrpl.js `XChainAddClaimAttestation.ts:76,113–116`;
87
+ * XRPL.org `xchainaddclaimattestation.md:87`;
88
+ * XLS-38 §2.3.3.1.10 (line 473).
89
+ *
90
+ * 5. **`XChainAttestationSequence` is NOT in the spec.** The class
91
+ * declares `XChainAttestationSequence: number` as a required
92
+ * field. XLS-38 §2.3.3.1 has no such field; xrpl.js's
93
+ * `XChainAddClaimAttestation` interface (lines 22–77) has no
94
+ * `XChainAttestationSequence`; XRPL.org's field table has no
95
+ * `XChainAttestationSequence`. The factory omits this field
96
+ * entirely.
97
+ * Source: xrpl.js `XChainAddClaimAttestation.ts:22–77`
98
+ * (no `XChainAttestationSequence` property);
99
+ * XRPL.org `xchainaddclaimattestation.md:76–87`
100
+ * (field table has no row for it);
101
+ * XLS-38 §2.3.3.1 lines 462–473
102
+ * (field table has no row for it).
103
+ *
104
+ * 6. **`XChainBridge` is fully shape-validated.** The class only
105
+ * checks `isRecord` (line 52), which accepts any object including
106
+ * `{}`. The factory uses the local `isXChainBridge` helper (4
107
+ * keys, both Issues valid currency objects, both doors as
108
+ * strings) AND verifies each door is a valid XRPL account
109
+ * (mirrors `xchain-account-create-commit.ts` Divergences #3-#4
110
+ * and `xchain-add-account-create-attestation.ts` Divergence #7,
111
+ * applies to all bridge-bearing transactions).
112
+ * Source: `src/validation/helpers.ts:168–177` (`isXChainBridge`);
113
+ * xrpl.js `common.ts` `isXChainBridge` source of truth.
114
+ *
115
+ * 7. **`Account`, `AttestationRewardAccount`, `AttestationSignerAccount`,
116
+ * and `OtherChainSource` are validated as valid XRPL classic or
117
+ * X-addresses.** The class delegates `Account` to the base
118
+ * transaction validator and does not validate the other three
119
+ * account fields at all. The factory uses `isAccount` for all
120
+ * four (and uses `isAccount` for the optional `Destination` when
121
+ * present), matching the rest of the M4 fp family and xrpl.js's
122
+ * `validateXChainAddClaimAttestation` (`XChainAddClaimAttestation.ts:92,94,96,98`).
123
+ *
124
+ * 8. **`PublicKey` and `Signature` must be non-empty hex Blobs.**
125
+ * xrpl.js only checks `isString`
126
+ * (`XChainAddClaimAttestation.ts:100,102`); XRPL.org marks both
127
+ * as `String / Blob` internal type
128
+ * (`xchainaddclaimattestation.md:83-84`). The factory enforces a
129
+ * non-empty, even-length hex string so malformed blobs surface at
130
+ * construction rather than at the binary codec layer. Per
131
+ * XLS-38 §2.3.3.1.6 (line 469) and §2.3.3.1.7 (line 470),
132
+ * `PublicKey` is conventionally a 33-byte compressed secp256k1
133
+ * key (66 hex chars), but the wire format accepts any Blob so
134
+ * we do NOT cap the length — the witness-server pubkey length is
135
+ * a network convention, not a tx-format rule.
136
+ * Source: XRPL.org `xchainaddclaimattestation.md:83-84`.
137
+ */
138
+ import type { XChainBridge } from '../../types/common.js';
139
+ export interface XchainAddClaimAttestationProps {
140
+ /** The unique address of the transaction sender (the witness
141
+ * submitting this attestation). Required, valid XRPL address. */
142
+ Account: string;
143
+ /** The amount committed by the `XChainCommit` transaction on the
144
+ * source chain. Currency Amount — XRP drops string, IOU object,
145
+ * or MPT object. Required.
146
+ * Source: XLS-38 §2.3.3.1.1 (line 464). */
147
+ Amount: string | Record<string, unknown>;
148
+ /** The account that should receive this signer's share of the
149
+ * `SignatureReward`. Required, valid XRPL address.
150
+ * Source: XLS-38 §2.3.3.1.2 (line 465). */
151
+ AttestationRewardAccount: string;
152
+ /** The account on the door account's signer list that is signing
153
+ * the transaction. Required, valid XRPL address.
154
+ * Source: XLS-38 §2.3.3.1.3 (line 466). */
155
+ AttestationSignerAccount: string;
156
+ /** The destination account for the funds on the destination chain
157
+ * (taken from the `XChainCommit` transaction). Optional per
158
+ * XLS-38 §2.3.3.1.4 (line 467), XRPL.org, and xrpl.js. When
159
+ * present must be a valid XRPL address.
160
+ * Source: XLS-38 §2.3.3.1.4 (line 467). */
161
+ Destination?: string | undefined;
162
+ /** The account on the source chain that submitted the `XChainCommit`
163
+ * transaction that triggered the event associated with the
164
+ * attestation. Required, valid XRPL address.
165
+ * Source: XLS-38 §2.3.3.1.5 (line 468). */
166
+ OtherChainSource: string;
167
+ /** The public key used to verify the attestation signature. Hex
168
+ * Blob; by convention a 33-byte compressed secp256k1 key (66 hex
169
+ * chars). Required. */
170
+ PublicKey: string;
171
+ /** The signature attesting to the event on the other chain. Hex
172
+ * Blob. Required. */
173
+ Signature: string;
174
+ /** Boolean (encoded as UInt8): true (=1) if the event occurred on
175
+ * the locking chain (so `OtherChainSource` is on the locking
176
+ * chain); false (=0) if on the issuing chain. Required, must be
177
+ * exactly `0` or `1`.
178
+ * Source: XLS-38 §2.3.3.1.8 (line 471). */
179
+ WasLockingChainSend: 0 | 1;
180
+ /** The `XChainClaimID` associated with the transfer, which was
181
+ * included in the `XChainCommit` transaction. UInt64 — accepts
182
+ * number or decimal string. Required.
183
+ * Source: XLS-38 §2.3.3.1.10 (line 473). */
184
+ XChainClaimID: number | string;
185
+ /** The bridge associated with the attestation. 4-key shape with
186
+ * both doors as valid XRPL accounts and both Issues as valid
187
+ * currency objects. Required.
188
+ * Source: XLS-38 §2.3.3.1.9 (line 472). */
189
+ XChainBridge: XChainBridge;
190
+ /** Bit-flags for this transaction. XChainAddClaimAttestation has no
191
+ * defined flags; only `tfFullyCanonicalSig` (global) is normally
192
+ * meaningful. Accepted for parity with the base tx shape. */
193
+ Flags?: number | undefined;
194
+ /** Fee in XRP (drops), base-10 integer string. */
195
+ Fee?: string | undefined;
196
+ /** Account sequence number. */
197
+ Sequence?: number | undefined;
198
+ }
199
+ export interface XchainAddClaimAttestation extends Readonly<XchainAddClaimAttestationProps> {
200
+ readonly TransactionType: 'XChainAddClaimAttestation';
201
+ validate(): void;
202
+ toJSON(): Record<string, unknown>;
203
+ with(overrides: Partial<XchainAddClaimAttestationProps>): XchainAddClaimAttestation;
204
+ }
205
+ export declare function xchainAddClaimAttestation(props: XchainAddClaimAttestationProps): XchainAddClaimAttestation;
206
+ //# sourceMappingURL=xchain-add-claim-attestation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-add-claim-attestation.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-add-claim-attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA8D1D,MAAM,WAAW,8BAA8B;IAC7C;sEACkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAEhB;;;gDAG4C;IAC5C,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC;;gDAE4C;IAC5C,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;gDAE4C;IAC5C,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;;;gDAI4C;IAC5C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;gDAG4C;IAC5C,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;4BAEwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAElB;0BACsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAElB;;;;gDAI4C;IAC5C,mBAAmB,EAAE,CAAC,GAAG,CAAC,CAAC;IAE3B;;;iDAG6C;IAC7C,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;;gDAG4C;IAC5C,YAAY,EAAE,YAAY,CAAC;IAE3B;;kEAE8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,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,CAyG3B"}
@@ -0,0 +1,97 @@
1
+ import { isAccount, isAmount, isHex, isNumber, isString, isXChainBridge, } from '../../validation/helpers.js';
2
+ import { ValidationError } from '../../errors.js';
3
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
4
+ // ─── Helpers ─────────────────────────────────────────────────────────
5
+ /**
6
+ * Validate a non-empty hex Blob per the XRPL.org field tables
7
+ * (`PublicKey` and `Signature`: `String / Blob` internal type). Even
8
+ * length is required for whole-byte serialisation.
9
+ */
10
+ function validateBlob(value, field) {
11
+ if (!isString(value)) {
12
+ throw new ValidationError(`XChainAddClaimAttestation: ${field} must be a hex string`);
13
+ }
14
+ if (value.length === 0) {
15
+ throw new ValidationError(`XChainAddClaimAttestation: ${field} must not be an empty string`);
16
+ }
17
+ if (!isHex(value)) {
18
+ throw new ValidationError(`XChainAddClaimAttestation: ${field} must be encoded in hex`);
19
+ }
20
+ if (value.length % 2 !== 0) {
21
+ throw new ValidationError(`XChainAddClaimAttestation: ${field} must have an even number of hex characters (whole-byte Blob encoding)`);
22
+ }
23
+ return value;
24
+ }
25
+ /**
26
+ * Verify both XChainBridge doors are valid XRPL account addresses
27
+ * (the local `isXChainBridge` helper only checks `typeof === 'string'`).
28
+ */
29
+ function assertValidXChainBridge(bridge) {
30
+ if (!isAccount(bridge.LockingChainDoor)) {
31
+ throw new ValidationError('XChainAddClaimAttestation: XChainBridge.LockingChainDoor must be a valid XRPL account address');
32
+ }
33
+ if (!isAccount(bridge.IssuingChainDoor)) {
34
+ throw new ValidationError('XChainAddClaimAttestation: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
35
+ }
36
+ }
37
+ // ─── Factory ─────────────────────────────────────────────────────────
38
+ export function xchainAddClaimAttestation(props) {
39
+ // ── Account ── required, valid XRPL classic/X-address.
40
+ require(props.Account, 'XChainAddClaimAttestation: missing or invalid Account', isAccount);
41
+ // ── Amount ── required, any Currency Amount form (XRP / IOU / MPT).
42
+ if (!isAmount(props.Amount)) {
43
+ throw new ValidationError('XChainAddClaimAttestation: Amount must be a Currency Amount (XRP drops string, IOU object, or MPT object)');
44
+ }
45
+ // ── AttestationRewardAccount ── required, valid XRPL account.
46
+ // Class API does not declare this field at all.
47
+ require(props.AttestationRewardAccount, 'XChainAddClaimAttestation: missing or invalid AttestationRewardAccount', isAccount);
48
+ // ── AttestationSignerAccount ── required, valid XRPL account.
49
+ // Class API does not declare this field at all.
50
+ require(props.AttestationSignerAccount, 'XChainAddClaimAttestation: missing or invalid AttestationSignerAccount', isAccount);
51
+ // ── Destination ── optional per spec, but when present must be a
52
+ // valid XRPL account.
53
+ if (props.Destination !== undefined) {
54
+ if (!isAccount(props.Destination)) {
55
+ throw new ValidationError('XChainAddClaimAttestation: Destination is not a valid XRPL account address');
56
+ }
57
+ }
58
+ // ── OtherChainSource ── required, valid XRPL account.
59
+ // Class API does not declare this field at all.
60
+ require(props.OtherChainSource, 'XChainAddClaimAttestation: missing or invalid OtherChainSource', isAccount);
61
+ // ── PublicKey ── required, non-empty even-length hex Blob.
62
+ validateBlob(props.PublicKey, 'PublicKey');
63
+ // ── Signature ── required, non-empty even-length hex Blob.
64
+ validateBlob(props.Signature, 'Signature');
65
+ // ── WasLockingChainSend ── required, exactly 0 or 1.
66
+ if (props.WasLockingChainSend !== 0 && props.WasLockingChainSend !== 1) {
67
+ throw new ValidationError('XChainAddClaimAttestation: WasLockingChainSend must be exactly 0 or 1 (UInt8 boolean)');
68
+ }
69
+ // ── XChainClaimID ── required, number OR string (UInt64).
70
+ if (!isNumber(props.XChainClaimID) && !isString(props.XChainClaimID)) {
71
+ throw new ValidationError('XChainAddClaimAttestation: XChainClaimID must be a number or decimal string (UInt64)');
72
+ }
73
+ // ── XChainBridge ── required, full shape (4 keys + valid Issues) +
74
+ // both doors as valid XRPL accounts.
75
+ require(props.XChainBridge, 'XChainAddClaimAttestation: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
76
+ assertValidXChainBridge(props.XChainBridge);
77
+ return buildFrozenTx('XChainAddClaimAttestation', props, {
78
+ validate() {
79
+ // Validated at construction.
80
+ },
81
+ toJSON() {
82
+ const json = {};
83
+ for (const k of Object.keys(this)) {
84
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
85
+ continue;
86
+ const v = this[k];
87
+ if (v !== undefined)
88
+ json[k] = v;
89
+ }
90
+ return json;
91
+ },
92
+ with(overrides) {
93
+ return xchainAddClaimAttestation(mergeForWith(this, overrides));
94
+ },
95
+ });
96
+ }
97
+ //# sourceMappingURL=xchain-add-claim-attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-add-claim-attestation.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-add-claim-attestation.ts"],"names":[],"mappings":"AA0IA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,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;;;;GAIG;AACH,SAAS,YAAY,CAAC,KAAc,EAAE,KA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6B;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,CAEF,SAAkD;YAElD,OAAO,yBAAyB,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAClE,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Functional XChainClaim factory — frozen-object style.
3
+ *
4
+ * Completes a cross-chain transfer of value by claiming funds on the
5
+ * destination chain after a quorum of witness attestations have been
6
+ * delivered for a corresponding `XChainCommit` transaction. Validation
7
+ * happens at construction; there is no way to construct an invalid tx.
8
+ *
9
+ * import { xchainClaim } from 'xrplt/fp';
10
+ * const tx = xchainClaim({
11
+ * Account,
12
+ * Amount: '10000',
13
+ * XChainClaimID: '13f',
14
+ * Destination: 'rahDmoXrtPdh7sUdrPjini3gcnTVYjbjjw',
15
+ * XChainBridge: {
16
+ * LockingChainDoor: 'rMAXACCrp3Y8PpswXcg3bKggHX76V3F8M4',
17
+ * LockingChainIssue: { currency: 'XRP' },
18
+ * IssuingChainDoor: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
19
+ * IssuingChainIssue: { currency: 'XRP' },
20
+ * },
21
+ * });
22
+ *
23
+ * Required amendment: `XChainBridge`.
24
+ *
25
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/xchainclaim
26
+ * @see xrpl.js `packages/xrpl/src/models/transactions/XChainClaim.ts`
27
+ * (`validateXChainClaim` — source of every required-field check in
28
+ * this factory).
29
+ * @see XLS-0038 §2.3.4 — "The `XChainClaim` transaction"
30
+ * `~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
31
+ * lines 519–559.
32
+ *
33
+ * ## Divergences
34
+ *
35
+ * Compared with `src/transactions/xchain-claim.ts`, this factory adds
36
+ * guards the class skips (or that xrpl.js / xrpl.org / XLS-38 mandate
37
+ * but the class omits):
38
+ *
39
+ * - **`Account` must be a valid XRPL classic or X-address.** The class
40
+ * accepts any string via `super.validate()` (which only checks
41
+ * `isString`). xrpl.js's `validateBaseTransaction` (which
42
+ * `validateXChainClaim` delegates to) enforces a valid classic
43
+ * address; we mirror that at construction.
44
+ * - Source: xrpl.js `common.ts` `validateBaseTransaction`.
45
+ * - Cross-ref: rippled parses `Account` as `STAccount`; only valid
46
+ * XRPL classic addresses parse.
47
+ *
48
+ * - **`Destination` must be a valid XRPL classic or X-address.** The
49
+ * class does not validate `Destination` at all (no `validate()` check,
50
+ * just `declare readonly Destination`). xrpl.js
51
+ * `validateXChainClaim` line 74 calls
52
+ * `validateRequiredField(tx, 'Destination', isAccount)`. xrpl.org
53
+ * `xchainclaim.md` line 47 marks it `String / AccountID`; XLS-38
54
+ * §2.3.4.1.3 line 548 defines `Destination` as `ACCOUNT`.
55
+ * - Source: xrpl.js `XChainClaim.ts` line 74.
56
+ * - Source: xrpl.org `xchainclaim.md` line 47.
57
+ * - Source: XLS-38 §2.3.4.1.3 line 548.
58
+ * - Cross-ref: rippled parses `Destination` as `STAccount`; only
59
+ * valid XRPL classic addresses parse.
60
+ *
61
+ * - **`XChainBridge` is fully shape-validated.** xrpl.js
62
+ * `validateXChainClaim` line 66 calls
63
+ * `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`, which
64
+ * requires exactly 4 keys, two `AccountID` door strings, and two
65
+ * `Issue` currency objects (`{currency: 'XRP'}` or
66
+ * `{currency, issuer}`). The class only verifies `isRecord`, which
67
+ * accepts any object (including `{}` or `{foo: 'bar'}`). The factory
68
+ * uses the local `isXChainBridge` helper to enforce the full shape.
69
+ * - Source: xrpl.js `common.ts` `isXChainBridge`.
70
+ * - Source: XLS-38 §2.1.1.1.2 lines 175–180 (bridge fields are
71
+ * `XCHAIN_BRIDGE` internal type; all 4 sub-fields required).
72
+ * - Cross-ref: our `src/validation/helpers.ts` `isXChainBridge`
73
+ * (lines 168–177) mirrors the xrpl.js check.
74
+ *
75
+ * - **Both `XChainBridge` doors must be valid XRPL classic / X
76
+ * addresses.** `isXChainBridge` only checks that the door strings
77
+ * are strings; rippled parses them as `STAccount`. The factory
78
+ * additionally runs `isAccount` on each door so a malformed door
79
+ * string is caught at construction.
80
+ * - Source: rippled `XChainBridge.h:94–126` (parses `sfLockingChainDoor`,
81
+ * `sfIssuingChainDoor` as `STAccount`).
82
+ * - Cross-ref: XLS-38 §2.1.1.1.2 line 177 (`LockingChainDoor` is
83
+ * `ACCOUNT`); line 179 (`IssuingChainDoor` is `ACCOUNT`).
84
+ *
85
+ * - **`XChainClaimID` accepts number OR decimal string (UInt64).** The
86
+ * class types the field as `number` only. xrpl.js types it as
87
+ * `number | string` (`XChainClaim.ts:35`) and validates with
88
+ * `isNumber(inp) || isString(inp)` (line 71). xrpl.org
89
+ * `xchainclaim.md` line 50 marks it `String / UInt64`; XLS-38
90
+ * §2.3.4.1.2 line 543 defines it as `UINT64`. The wire format
91
+ * encodes UInt64 as a decimal string; callers frequently pass it as
92
+ * a string. The factory accepts either, and when a string is provided
93
+ * verifies it is a decimal integer in `[0, 2^64-1]`.
94
+ * - Source: xrpl.js `XChainClaim.ts:35,68–72`.
95
+ * - Source: xrpl.org `xchainclaim.md` line 50.
96
+ * - Source: XLS-38 §2.3.4.1.2 line 543.
97
+ *
98
+ * - **`DestinationTag` is exposed (XLS-38 §2.3.4.1.4).** The class
99
+ * does not declare this field at all. xrpl.js marks it optional with
100
+ * `DestinationTag?: number` (`XChainClaim.ts:48`) and validates with
101
+ * `validateOptionalField(tx, 'DestinationTag', isNumber)` (line 76).
102
+ * xrpl.org `xchainclaim.md` line 48 marks it `Number / UInt32`
103
+ * optional; XLS-38 §2.3.4.1.4 line 551 defines it as `UINT32`. The
104
+ * factory exposes the field, requires it to be a UInt32 when present,
105
+ * and rejects non-integers / negatives / values > 4294967295.
106
+ * - Source: xrpl.js `XChainClaim.ts:48,76`.
107
+ * - Source: xrpl.org `xchainclaim.md` line 48.
108
+ * - Source: XLS-38 §2.3.4.1.4 line 551.
109
+ *
110
+ * - **`Amount` must be strictly positive.** The class delegates to
111
+ * `isAmount`, which accepts `Amount: '0'` (XRP string) and
112
+ * `{value: '0'}` (IOU/MPT). Per XLS-38 §2.3.4.1.5 line 559, "This
113
+ * must match the amount attested to on the attestations associated
114
+ * with this `XChainClaimID`." The attestations record a non-zero
115
+ * amount (XChainCommit cannot commit 0), so a 0 Amount here would
116
+ * never match an attestation and would be rejected on-ledger. The
117
+ * factory enforces `> 0` across all three Amount forms (XRP string,
118
+ * IOU `value`, MPT `value`).
119
+ * - Source: XLS-38 §2.3.4.1.5 line 559 ("must match the amount
120
+ * attested to ... XChainClaimID").
121
+ * - Source: XLS-38 §2.3.2.1.3 line 440 (XChainCommit Amount must
122
+ * match the door's `LockingChainIssue`/`IssuingChainIssue`; the
123
+ * commit must be a positive transfer).
124
+ * - Cross-ref: xrpl.js `isAmount` accepts any shape; the strict
125
+ * `> 0` check is a factory addition.
126
+ *
127
+ * - **`OtherChainSource` is NOT a field on this transaction.** Some
128
+ * XLS-38 transactions carry an `OtherChainSource` (e.g.
129
+ * `XChainAddClaimAttestation` §2.3.3.1.5), but it is explicitly
130
+ * absent from XChainClaim's field table (§2.3.4.1 lines 533–537).
131
+ * The factory correctly omits `OtherChainSource`. (Documented for
132
+ * awareness; this is a spec clarification, not a divergence from the
133
+ * class.)
134
+ * - Source: XLS-38 §2.3.4.1 lines 533–537 (no `OtherChainSource`
135
+ * row in the field table).
136
+ * - Source: XLS-38 §2.3.3.1.5 line 468 (the attestation carries
137
+ * `OtherChainSource`, not the claim).
138
+ *
139
+ * - **`Flags` accepted for parity with the base transaction shape.**
140
+ * XChainClaim itself defines no transaction-specific flags; only
141
+ * `tfFullyCanonicalSig` (global) is normally meaningful. The class
142
+ * does not declare a `Flags` field. We accept a numeric bitmask
143
+ * for parity with the rest of the fp family.
144
+ * - Source: XLS-38 §2.3.4.1 lines 533–537 (no `Flags` row).
145
+ * - Cross-ref: rippled accepts the `Flags` field for any transaction
146
+ * (it just defaults to `tfFullyCanonicalSig`).
147
+ */
148
+ import type { Amount } from '../../types/amounts.js';
149
+ import type { XChainBridge } from '../../types/common.js';
150
+ export interface XchainClaimProps {
151
+ /** The unique address of the transaction sender (the account that
152
+ * owns the `XChainOwnedClaimID` on the destination chain). */
153
+ Account: string;
154
+ /** The bridge associated with this transfer. 4-key shape with both
155
+ * doors as valid XRPL classic/X addresses and both Issues as valid
156
+ * currency objects. */
157
+ XChainBridge: XChainBridge;
158
+ /** The unique integer ID for a cross-chain transfer that was
159
+ * referenced in the corresponding `XChainCommit` transaction.
160
+ * UInt64 — accepts number or decimal string. */
161
+ XChainClaimID: number | string;
162
+ /** The destination account on the destination chain. Must exist for
163
+ * the transaction to succeed. Valid XRPL classic/X address. */
164
+ Destination: string;
165
+ /** Optional UInt32 destination tag. */
166
+ DestinationTag?: number | undefined;
167
+ /** The amount to claim on the destination chain. Must match the
168
+ * amount attested to on the attestations associated with this
169
+ * `XChainClaimID`. Strictly positive (> 0). */
170
+ Amount: Amount;
171
+ /** Bit-flags for this transaction. XChainClaim has no defined
172
+ * flags; only `tfFullyCanonicalSig` (global) is normally meaningful.
173
+ * Accepted for parity with the base tx shape. */
174
+ Flags?: number | undefined;
175
+ /** Fee in XRP (drops), base-10 integer string. */
176
+ Fee?: string | undefined;
177
+ /** Account sequence number. */
178
+ Sequence?: number | undefined;
179
+ }
180
+ export interface XchainClaim extends Readonly<XchainClaimProps> {
181
+ readonly TransactionType: 'XChainClaim';
182
+ validate(): void;
183
+ toJSON(): Record<string, unknown>;
184
+ with(overrides: Partial<XchainClaimProps>): XchainClaim;
185
+ }
186
+ export declare function xchainClaim(props: XchainClaimProps): XchainClaim;
187
+ //# sourceMappingURL=xchain-claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-claim.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-claim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkJG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoJ1D,MAAM,WAAW,gBAAgB;IAC/B;mEAC+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAEhB;;4BAEwB;IACxB,YAAY,EAAE,YAAY,CAAC;IAE3B;;qDAEiD;IACjD,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;oEACgE;IAChE,WAAW,EAAE,MAAM,CAAC;IAEpB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC;;oDAEgD;IAChD,MAAM,EAAE,MAAM,CAAC;IAEf;;sDAEkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,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,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAC7D,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;IACxC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAAC;CACzD;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAsEhE"}
@@ -0,0 +1,140 @@
1
+ import { isAccount, isAmount, isIssuedCurrencyAmount, isMPTAmount, isNumber, isString, isXChainBridge, } from '../../validation/helpers.js';
2
+ import { ValidationError } from '../../errors.js';
3
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
4
+ // ─── Spec constants ──────────────────────────────────────────────────
5
+ // XLS-38 §2.3.4.1.2 line 543: XChainClaimID is UInt64.
6
+ const UINT64_MIN = 0n;
7
+ const UINT64_MAX = (1n << 64n) - 1n;
8
+ // XLS-38 §2.3.4.1.4 line 551: DestinationTag is UInt32.
9
+ const UINT32_MIN = 0;
10
+ const UINT32_MAX = 0xffffffff;
11
+ // Non-negative base-10 integer string used for Amount value parsing.
12
+ const DECIMAL_INT_REGEX = /^[0-9]+$/u;
13
+ // ─── Helpers ─────────────────────────────────────────────────────────
14
+ /**
15
+ * Verify both XChainBridge doors are valid XRPL account addresses
16
+ * (the local `isXChainBridge` helper only checks `typeof === 'string'`).
17
+ */
18
+ function assertValidXChainBridge(bridge) {
19
+ if (!isAccount(bridge.LockingChainDoor)) {
20
+ throw new ValidationError('XChainClaim: XChainBridge.LockingChainDoor must be a valid XRPL account address');
21
+ }
22
+ if (!isAccount(bridge.IssuingChainDoor)) {
23
+ throw new ValidationError('XChainClaim: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
24
+ }
25
+ }
26
+ /**
27
+ * Validate that an Amount is strictly positive across all three forms
28
+ * (XRP drops string, IssuedCurrencyAmount, MPTAmount). Mirrors the
29
+ * OfferCreate / NFTokenCreateOffer positivity checks but accepts any
30
+ * Amount shape (XChainClaim is bridge-agnostic; XRP-XRP and IOU-IOU
31
+ * bridges are both supported, XLS-38 §2.3.4 has no asset restriction).
32
+ */
33
+ function validatePositiveAmount(amount, path) {
34
+ if (!isAmount(amount)) {
35
+ throw new ValidationError(`XChainClaim: ${path} must be a valid Amount (XRP drops string, IOU object, or MPT object)`);
36
+ }
37
+ if (isString(amount)) {
38
+ if (!DECIMAL_INT_REGEX.test(amount)) {
39
+ throw new ValidationError(`XChainClaim: ${path} (XRP) must be a non-negative base-10 integer string`);
40
+ }
41
+ if (amount === '0') {
42
+ throw new ValidationError(`XChainClaim: ${path} must be strictly positive (XRP); got "0"`);
43
+ }
44
+ return;
45
+ }
46
+ if (isIssuedCurrencyAmount(amount)) {
47
+ if (!isString(amount.value) || !DECIMAL_INT_REGEX.test(amount.value)) {
48
+ throw new ValidationError(`XChainClaim: ${path}.value must be a non-negative base-10 integer string`);
49
+ }
50
+ if (amount.value === '0') {
51
+ throw new ValidationError(`XChainClaim: ${path} must be strictly positive (IOU); got value "0"`);
52
+ }
53
+ return;
54
+ }
55
+ if (isMPTAmount(amount)) {
56
+ if (!isString(amount.value) || !DECIMAL_INT_REGEX.test(amount.value)) {
57
+ throw new ValidationError(`XChainClaim: ${path}.value must be a non-negative base-10 integer string`);
58
+ }
59
+ if (amount.value === '0') {
60
+ throw new ValidationError(`XChainClaim: ${path} must be strictly positive (MPT); got value "0"`);
61
+ }
62
+ return;
63
+ }
64
+ // Unreachable — defensive.
65
+ throw new ValidationError(`XChainClaim: ${path} must be a valid Amount (XRP drops string, IOU object, or MPT object)`);
66
+ }
67
+ /**
68
+ * Validate that an XChainClaimID value (number or decimal string)
69
+ * fits in `[0, 2^64-1]`. The wire format encodes UInt64 as a decimal
70
+ * string; this helper normalises both forms into BigInt and range-
71
+ * checks.
72
+ */
73
+ function validateXChainClaimIDValue(value, field) {
74
+ if (typeof value === 'number') {
75
+ if (!Number.isInteger(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {
76
+ throw new ValidationError(`XChainClaim: ${field} numeric form must be a non-negative safe integer (UInt64)`);
77
+ }
78
+ return;
79
+ }
80
+ if (!DECIMAL_INT_REGEX.test(value)) {
81
+ throw new ValidationError(`XChainClaim: ${field} string form must be a decimal integer (UInt64)`);
82
+ }
83
+ let big;
84
+ try {
85
+ big = BigInt(value);
86
+ }
87
+ catch {
88
+ throw new ValidationError(`XChainClaim: ${field} string form is not a valid integer (UInt64)`);
89
+ }
90
+ if (big < UINT64_MIN || big > UINT64_MAX) {
91
+ throw new ValidationError(`XChainClaim: ${field} is out of UInt64 range [0, ${UINT64_MAX}]`);
92
+ }
93
+ }
94
+ // ─── Factory ─────────────────────────────────────────────────────────
95
+ export function xchainClaim(props) {
96
+ // ── Account ── required, valid XRPL classic/X-address.
97
+ require(props.Account, 'XChainClaim: missing or invalid Account', isAccount);
98
+ // ── XChainBridge ── required, full shape (4 keys + valid Issues) +
99
+ // both doors as valid XRPL accounts.
100
+ require(props.XChainBridge, 'XChainClaim: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
101
+ assertValidXChainBridge(props.XChainBridge);
102
+ // ── XChainClaimID ── required, number OR decimal string (UInt64).
103
+ if (!isNumber(props.XChainClaimID) && !isString(props.XChainClaimID)) {
104
+ throw new ValidationError('XChainClaim: XChainClaimID must be a number or decimal string (UInt64)');
105
+ }
106
+ validateXChainClaimIDValue(props.XChainClaimID, 'XChainClaimID');
107
+ // ── Destination ── required, valid XRPL account.
108
+ require(props.Destination, 'XChainClaim: missing or invalid Destination', isAccount);
109
+ // ── DestinationTag ── optional UInt32 (XLS-38 §2.3.4.1.4).
110
+ if (props.DestinationTag !== undefined) {
111
+ if (!isNumber(props.DestinationTag) ||
112
+ !Number.isInteger(props.DestinationTag) ||
113
+ props.DestinationTag < UINT32_MIN ||
114
+ props.DestinationTag > UINT32_MAX) {
115
+ throw new ValidationError(`XChainClaim: DestinationTag must be a UInt32 in [${UINT32_MIN}, ${UINT32_MAX}]`);
116
+ }
117
+ }
118
+ // ── Amount ── required, any Currency Amount form, strictly positive.
119
+ validatePositiveAmount(props.Amount, 'Amount');
120
+ return buildFrozenTx('XChainClaim', props, {
121
+ validate() {
122
+ // Validated at construction.
123
+ },
124
+ toJSON() {
125
+ const json = {};
126
+ for (const k of Object.keys(this)) {
127
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
128
+ continue;
129
+ const v = this[k];
130
+ if (v !== undefined)
131
+ json[k] = v;
132
+ }
133
+ return json;
134
+ },
135
+ with(overrides) {
136
+ return xchainClaim(mergeForWith(this, overrides));
137
+ },
138
+ });
139
+ }
140
+ //# sourceMappingURL=xchain-claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-claim.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-claim.ts"],"names":[],"mappings":"AAqJA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,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,uDAAuD;AACvD,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;AAEpC,wDAAwD;AACxD,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,wEAAwE;AAExE;;;GAGG;AACH,SAAS,uBAAuB,CAAC,MAAoB;IACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,iFAAiF,CAClF,CAAC;I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