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,168 @@
1
+ /**
2
+ * Functional XChainCommit factory — frozen-object style.
3
+ *
4
+ * Locks assets on the locking chain to start a cross-chain transfer.
5
+ * Validation happens at construction; there is no way to construct an
6
+ * invalid tx.
7
+ *
8
+ * import { xchainCommit } from 'xrplt/fp';
9
+ * const tx = xchainCommit({
10
+ * Account,
11
+ * Amount: '10000',
12
+ * XChainClaimID: '13f',
13
+ * OtherChainDestination: 'rahDmoXrtPdh7sUdrPjini3gcnTVYjbjjw',
14
+ * XChainBridge: {
15
+ * LockingChainDoor: 'rMAXACCrp3Y8PpswXcg3bKggHX76V3F8M4',
16
+ * LockingChainIssue: { currency: 'XRP' },
17
+ * IssuingChainDoor: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
18
+ * IssuingChainIssue: { currency: 'XRP' },
19
+ * },
20
+ * });
21
+ * const j = tx.toJSON();
22
+ *
23
+ * Required amendment: `XChainBridge`.
24
+ *
25
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/xchaincommit
26
+ * @see xrpl.js `packages/xrpl/src/models/transactions/XChainCommit.ts`
27
+ * (`validateXChainCommit` — source of every required-field check in
28
+ * this factory).
29
+ * @see XLS-0038 §2.3.2 — "The `XChainCommit` transaction"
30
+ * (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
31
+ * lines 412–447)
32
+ *
33
+ * ## Divergences
34
+ *
35
+ * Compared with `src/transactions/xchain-commit.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
+ * `validateXChainCommit` 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
+ * - **`XChainBridge` is fully shape-validated.** xrpl.js
49
+ * `validateXChainCommit` line 65 calls
50
+ * `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`, which
51
+ * requires exactly 4 keys, two `AccountID` door strings, and two
52
+ * `Issue` currency objects (`{currency: 'XRP'}` or
53
+ * `{currency, issuer}`). The class only verifies `isRecord`, which
54
+ * accepts any object (including `{}` or `{foo: 'bar'}`). The factory
55
+ * uses the local `isXChainBridge` helper to enforce the full shape.
56
+ * - Source: xrpl.js `common.ts` `isXChainBridge`.
57
+ * - Source: XLS-38 §2.1.1.1.2 lines 175–180 (bridge fields are
58
+ * `XCHAIN_BRIDGE` internal type; all 4 sub-fields required).
59
+ * - Cross-ref: our `src/validation/helpers.ts` `isXChainBridge`
60
+ * (lines 168–177) mirrors the xrpl.js check.
61
+ *
62
+ * - **Both `XChainBridge` doors must be valid XRPL classic / X
63
+ * addresses.** `isXChainBridge` only checks that the door strings are
64
+ * strings; rippled parses them as `STAccount`. The factory
65
+ * additionally runs `isAccount` on each door so a malformed door
66
+ * string is caught at construction.
67
+ * - Source: rippled `XChainBridge.h` (parses `sfLockingChainDoor`,
68
+ * `sfIssuingChainDoor` as `STAccount`).
69
+ * - Cross-ref: XLS-38 §2.1.1.1.2 line 177 (`LockingChainDoor` is
70
+ * `ACCOUNT`); line 179 (`IssuingChainDoor` is `ACCOUNT`).
71
+ *
72
+ * - **`XChainClaimID` accepts number OR decimal string (UInt64).** The
73
+ * class types the field as `number` only. xrpl.js types it as
74
+ * `number | string` (`XChainCommit.ts:38`) and validates with
75
+ * `isNumber(inp) || isString(inp)` (line 70). xrpl.org
76
+ * `xchaincommit.md` line 47 marks it `String / UInt64`; XLS-38
77
+ * §2.3.2.1.2 line 432 defines it as `UINT64`. The wire format
78
+ * encodes UInt64 as a decimal string; callers frequently pass it as
79
+ * a string. The factory accepts either, and when a string is
80
+ * provided verifies it is a decimal integer in `[0, 2^64-1]`.
81
+ * - Source: xrpl.js `XChainCommit.ts:38,67–71`.
82
+ * - Source: xrpl.org `xchaincommit.md` line 47.
83
+ * - Source: XLS-38 §2.3.2.1.2 line 432.
84
+ *
85
+ * - **`OtherChainDestination` is optional, but when present must be a
86
+ * valid XRPL classic / X-address.** XLS-38 §2.3.2.1.4 line 422
87
+ * defines it as `ACCOUNT` and marks the field OPTIONAL. xrpl.org
88
+ * `xchaincommit.md` line 50 confirms `Required? No`. xrpl.js
89
+ * `validateXChainCommit` line 73 calls
90
+ * `validateOptionalField(tx, 'OtherChainDestination', isAccount)`.
91
+ * The class declares `OtherChainDestination?: string | undefined`
92
+ * without any `isAccount` check; any string passes. The factory
93
+ * enforces the XRPL-account format when present.
94
+ * - Source: xrpl.js `XChainCommit.ts:46,73`.
95
+ * - Source: xrpl.org `xchaincommit.md` line 50 (No).
96
+ * - Source: XLS-38 §2.3.2.1.4 line 422 (`ACCOUNT`, no required check).
97
+ *
98
+ * - **`Amount` must be strictly positive.** The class delegates to
99
+ * `isAmount`, which accepts `Amount: '0'` (XRP string) and
100
+ * `{value: '0'}` (IOU/MPT). Per XLS-38 §2.3.2.1.3 line 440, "The
101
+ * asset to commit, and the quantity. This must match the door
102
+ * account's LockingChainIssue (if on the locking chain) or the door
103
+ * account's IssuingChainIssue (if on the issuing chain)." The bridge
104
+ * can only be funded with a positive transfer; zero is meaningless
105
+ * and would be rejected on-ledger. The factory enforces `> 0` across
106
+ * all three Amount forms (XRP string, IOU `value`, MPT `value`).
107
+ * - Source: XLS-38 §2.3.2.1.3 line 440.
108
+ * - Cross-ref: xrpl.js `isAmount` accepts any shape; the strict
109
+ * `> 0` check is a factory addition.
110
+ *
111
+ * - **`Amount` shape sub-checks for IOU and MPT.** For IOU, the
112
+ * `issuer` must be a valid XRPL account address (rippled parses
113
+ * `STAmount.issuer` as `STAccount`); for both IOU and MPT, `value`
114
+ * must be a non-negative base-10 integer string (matching the XRPL
115
+ * wire format). The class's `isAmount` only checks structural keys;
116
+ * it does not validate `issuer` against `isAccount` or `value`
117
+ * against the decimal regex.
118
+ * - Source: rippled `Amount.cpp` (parses `issuer` as `STAccount`).
119
+ * - Source: rippled `STAmount.cpp` (parses `value` as decimal
120
+ * integer string).
121
+ *
122
+ * - **`Flags` accepted for parity with the base transaction shape.**
123
+ * XChainCommit itself defines no transaction-specific flags; only
124
+ * `tfFullyCanonicalSig` (global) is normally meaningful. The class
125
+ * does not declare a `Flags` field. We accept a numeric bitmask for
126
+ * parity with the rest of the fp family.
127
+ * - Source: XLS-38 §2.3.2.1 lines 414–418 (no `Flags` row).
128
+ * - Cross-ref: rippled accepts the `Flags` field for any transaction
129
+ * (it just defaults to `tfFullyCanonicalSig`).
130
+ */
131
+ import type { Amount } from '../../types/amounts.js';
132
+ import type { XChainBridge } from '../../types/common.js';
133
+ export interface XchainCommitProps {
134
+ /** The unique address of the transaction sender (the account that
135
+ * funds the lock-and-unwrap). */
136
+ Account: string;
137
+ /** The bridge to use to transfer funds. 4-key shape with both doors
138
+ * as valid XRPL classic/X addresses and both Issues as valid
139
+ * currency objects. */
140
+ XChainBridge: XChainBridge;
141
+ /** The unique integer ID for a cross-chain transfer that was created
142
+ * on the destination chain via an `XChainCreateClaimID` transaction.
143
+ * UInt64 — accepts number or decimal string. */
144
+ XChainClaimID: number | string;
145
+ /** The asset to commit, and the quantity. Must match the door
146
+ * account's `LockingChainIssue` (locking chain) or
147
+ * `IssuingChainIssue` (issuing chain). Strictly positive (> 0). */
148
+ Amount: Amount;
149
+ /** The destination account on the destination chain. Optional.
150
+ * If not specified, the account that submitted the
151
+ * `XChainCreateClaimID` transaction on the destination chain will
152
+ * need to submit an `XChainClaim` transaction to claim the funds. */
153
+ OtherChainDestination?: string | undefined;
154
+ /** Bit-flags for this transaction. XChainCommit has no defined
155
+ * flags; only `tfFullyCanonicalSig` (global) is normally meaningful.
156
+ * Accepted for parity with the base tx shape. */
157
+ Flags?: number | undefined;
158
+ Fee?: string | undefined;
159
+ Sequence?: number | undefined;
160
+ }
161
+ export interface XchainCommit extends Readonly<XchainCommitProps> {
162
+ readonly TransactionType: 'XChainCommit';
163
+ validate(): void;
164
+ toJSON(): Record<string, unknown>;
165
+ with(overrides: Partial<XchainCommitProps>): XchainCommit;
166
+ }
167
+ export declare function xchainCommit(props: XchainCommitProps): XchainCommit;
168
+ //# sourceMappingURL=xchain-commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-commit.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAwJ1D,MAAM,WAAW,iBAAiB;IAChC;sCACkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB;;4BAEwB;IACxB,YAAY,EAAE,YAAY,CAAC;IAE3B;;qDAEiD;IACjD,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;wEAEoE;IACpE,MAAM,EAAE,MAAM,CAAC;IAEf;;;0EAGsE;IACtE,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3C;;sDAEkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC;IACzC,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,YAAY,CAAC;CAC3D;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA2DnE"}
@@ -0,0 +1,137 @@
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.2.1.2 line 432: XChainClaimID is UInt64.
6
+ const UINT64_MIN = 0n;
7
+ const UINT64_MAX = (1n << 64n) - 1n;
8
+ // Non-negative base-10 integer string used for Amount value parsing.
9
+ const DECIMAL_INT_REGEX = /^[0-9]+$/u;
10
+ // ─── Helpers ─────────────────────────────────────────────────────────
11
+ /**
12
+ * Verify both XChainBridge doors are valid XRPL account addresses
13
+ * (the local `isXChainBridge` helper only checks `typeof === 'string'`).
14
+ */
15
+ function assertValidXChainBridge(bridge) {
16
+ if (!isAccount(bridge.LockingChainDoor)) {
17
+ throw new ValidationError('XChainCommit: XChainBridge.LockingChainDoor must be a valid XRPL account address');
18
+ }
19
+ if (!isAccount(bridge.IssuingChainDoor)) {
20
+ throw new ValidationError('XChainCommit: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
21
+ }
22
+ }
23
+ /**
24
+ * Validate that an Amount is strictly positive across all three forms
25
+ * (XRP drops string, IssuedCurrencyAmount, MPTAmount). XChainCommit is
26
+ * bridge-agnostic: XRP-XRP and IOU-IOU bridges are both supported,
27
+ * per XLS-38 §2.3.2.1.3 line 440.
28
+ */
29
+ function validatePositiveAmount(amount, path) {
30
+ if (!isAmount(amount)) {
31
+ throw new ValidationError(`XChainCommit: ${path} must be a valid Amount (XRP drops string, IOU object, or MPT object)`);
32
+ }
33
+ if (isString(amount)) {
34
+ if (!DECIMAL_INT_REGEX.test(amount)) {
35
+ throw new ValidationError(`XChainCommit: ${path} (XRP) must be a non-negative base-10 integer string`);
36
+ }
37
+ if (amount === '0') {
38
+ throw new ValidationError(`XChainCommit: ${path} must be strictly positive (XRP); got "0"`);
39
+ }
40
+ return;
41
+ }
42
+ if (isIssuedCurrencyAmount(amount)) {
43
+ if (!isAccount(amount.issuer)) {
44
+ throw new ValidationError(`XChainCommit: ${path}.issuer must be a valid XRPL account address`);
45
+ }
46
+ if (!isString(amount.value) || !DECIMAL_INT_REGEX.test(amount.value)) {
47
+ throw new ValidationError(`XChainCommit: ${path}.value must be a non-negative base-10 integer string`);
48
+ }
49
+ if (amount.value === '0') {
50
+ throw new ValidationError(`XChainCommit: ${path} must be strictly positive (IOU); got value "0"`);
51
+ }
52
+ return;
53
+ }
54
+ if (isMPTAmount(amount)) {
55
+ if (!isString(amount.value) || !DECIMAL_INT_REGEX.test(amount.value)) {
56
+ throw new ValidationError(`XChainCommit: ${path}.value must be a non-negative base-10 integer string`);
57
+ }
58
+ if (amount.value === '0') {
59
+ throw new ValidationError(`XChainCommit: ${path} must be strictly positive (MPT); got value "0"`);
60
+ }
61
+ return;
62
+ }
63
+ // Unreachable — defensive.
64
+ throw new ValidationError(`XChainCommit: ${path} must be a valid Amount (XRP drops string, IOU object, or MPT object)`);
65
+ }
66
+ /**
67
+ * Validate that an XChainClaimID value (number or decimal string) fits
68
+ * in `[0, 2^64-1]`. The wire format encodes UInt64 as a decimal
69
+ * string; this helper normalises both forms into BigInt and
70
+ * range-checks.
71
+ */
72
+ function validateXChainClaimIDValue(value, field) {
73
+ if (typeof value === 'number') {
74
+ if (!Number.isInteger(value) ||
75
+ value < 0 ||
76
+ value > Number.MAX_SAFE_INTEGER) {
77
+ throw new ValidationError(`XChainCommit: ${field} numeric form must be a non-negative safe integer (UInt64)`);
78
+ }
79
+ return;
80
+ }
81
+ if (!DECIMAL_INT_REGEX.test(value)) {
82
+ throw new ValidationError(`XChainCommit: ${field} string form must be a decimal integer (UInt64)`);
83
+ }
84
+ let big;
85
+ try {
86
+ big = BigInt(value);
87
+ }
88
+ catch {
89
+ throw new ValidationError(`XChainCommit: ${field} string form is not a valid integer (UInt64)`);
90
+ }
91
+ if (big < UINT64_MIN || big > UINT64_MAX) {
92
+ throw new ValidationError(`XChainCommit: ${field} is out of UInt64 range [0, ${UINT64_MAX}]`);
93
+ }
94
+ }
95
+ // ─── Factory ─────────────────────────────────────────────────────────
96
+ export function xchainCommit(props) {
97
+ // ── Account ── required, valid XRPL classic/X-address.
98
+ require(props.Account, 'XChainCommit: missing or invalid Account', isAccount);
99
+ // ── XChainBridge ── required, full shape (4 keys + valid Issues) +
100
+ // both doors as valid XRPL accounts.
101
+ require(props.XChainBridge, 'XChainCommit: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
102
+ assertValidXChainBridge(props.XChainBridge);
103
+ // ── XChainClaimID ── required, number OR decimal string (UInt64).
104
+ if (!isNumber(props.XChainClaimID) && !isString(props.XChainClaimID)) {
105
+ throw new ValidationError('XChainCommit: XChainClaimID must be a number or decimal string (UInt64)');
106
+ }
107
+ validateXChainClaimIDValue(props.XChainClaimID, 'XChainClaimID');
108
+ // ── Amount ── required, any Currency Amount form, strictly positive.
109
+ validatePositiveAmount(props.Amount, 'Amount');
110
+ // ── OtherChainDestination ── optional, valid XRPL account when
111
+ // present (XLS-38 §2.3.2.1.4 line 422: `ACCOUNT`, not required).
112
+ if (props.OtherChainDestination !== undefined) {
113
+ if (!isAccount(props.OtherChainDestination)) {
114
+ throw new ValidationError('XChainCommit: OtherChainDestination must be a valid XRPL account address');
115
+ }
116
+ }
117
+ return buildFrozenTx('XChainCommit', props, {
118
+ validate() {
119
+ // Validated at construction.
120
+ },
121
+ toJSON() {
122
+ const json = {};
123
+ for (const k of Object.keys(this)) {
124
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
125
+ continue;
126
+ const v = this[k];
127
+ if (v !== undefined)
128
+ json[k] = v;
129
+ }
130
+ return json;
131
+ },
132
+ with(overrides) {
133
+ return xchainCommit(mergeForWith(this, overrides));
134
+ },
135
+ });
136
+ }
137
+ //# sourceMappingURL=xchain-commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-commit.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-commit.ts"],"names":[],"mappings":"AAoIA,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,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,kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACvB,kFAAkF,CACnF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,MAAc,EAAE,IAAY;IAC1D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,eAAe,CACvB,iBAAiB,IAAI,uEAAuE,CAC7F,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,MAAM,IA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C,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,eAAe,CACvB,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,0BAA0B,CAAC,KAAK,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IAEjE,sEAAsE;IACtE,sBAAsB,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE/C,gEAAgE;IAChE,oEAAoE;IACpE,IAAI,KAAK,CAAC,qBAAqB,KAAK,SAAS,EAAE,CAAC;QAC9C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,eAAe,CACvB,0EAA0E,CAC3E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAClB,cAAc,EACd,KAAK,EACL;QACE,QAAQ;YACN,6BAA6B;QAC/B,CAAC;QACD,MAAM;YACJ,MAAM,IAAI,GAA4B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,MAAM;oBAAE,SAAS;gBACjE,MAAM,CAAC,GAAI,IAA2C,CAAC,CAAC,CAAC,CAAC;gBAC1D,IAAI,CAAC,KAAK,SAAS;oBAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAqB,SAAqC;YAC5D,OAAO,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QACrD,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Functional XChainCreateBridge factory — frozen-object style.
3
+ *
4
+ * Defines a new cross-chain bridge on the chain the transaction is
5
+ * sent from. The transaction creates a `Bridge` ledger entry owned by
6
+ * the door account. The same transaction must be submitted by the
7
+ * corresponding door account on the other chain to complete bridge
8
+ * setup. Validation happens at construction; there is no way to
9
+ * construct an invalid tx.
10
+ *
11
+ * import { xchainCreateBridge } from 'xrplt/fp';
12
+ * const tx = xchainCreateBridge({
13
+ * Account: 'rhWQzvdmhf5vFS35vtKUSUwNZHGT53qQsg',
14
+ * XChainBridge: {
15
+ * LockingChainDoor: 'rhWQzvdmhf5vFS35vtKUSUwNZHGT53qQsg',
16
+ * LockingChainIssue: { currency: 'XRP' },
17
+ * IssuingChainDoor: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
18
+ * IssuingChainIssue: { currency: 'XRP' },
19
+ * },
20
+ * SignatureReward: '200',
21
+ * });
22
+ * const j = tx.toJSON();
23
+ *
24
+ * @see https://xrpl.org/docs/references/protocol/transactions/types/xchaincreatebridge
25
+ * @see https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/transactions/XChainCreateBridge.ts
26
+ * @see XLS-0038 (Cross-Chain Bridge) §2.2.1
27
+ * (`~/.mavis/docs.local/xrpl-standards/repo/XLS-0038-cross-chain-bridge/README.md`
28
+ * lines 300–332)
29
+ *
30
+ * ## Divergences
31
+ *
32
+ * Compared with `src/transactions/xchain-create-bridge.ts`, this factory
33
+ * adds guards the class skips (or that xrpl.js / xrpl.org / XLS-38
34
+ * mandate but the class omits):
35
+ *
36
+ * - **`Account` must be a valid XRPL classic or X-address.** The class
37
+ * accepts any non-empty string — only the base transaction
38
+ * `super.validate()` is invoked. xrpl.js's
39
+ * `validateBaseTransaction` (which `validateXChainCreateBridge`
40
+ * delegates to) requires a string; we additionally enforce the XRPL
41
+ * classic/X-address format at construction, matching every other fp
42
+ * factory.
43
+ * - Source: xrpl.js
44
+ * `~/.mavis/docs.local/xrpl.js/repo/packages/xrpl/src/models/transactions/common.ts`
45
+ * `validateBaseTransaction`.
46
+ * - Cross-ref: rippled `XChainBridge.cpp` `preflight` parses
47
+ * `Account` as `STAccount`; only valid XRPL classic addresses
48
+ * parse. xrpl.org `xchaincreatebridge.md` example line 28 lists
49
+ * `Account` as the door account on the locking chain.
50
+ *
51
+ * - **`XChainBridge` is fully shape-validated.** xrpl.js
52
+ * `validateXChainCreateBridge.ts:51` calls
53
+ * `validateRequiredField(tx, 'XChainBridge', isXChainBridge)`,
54
+ * which requires exactly 4 keys, two `AccountID` door strings, and
55
+ * two `Issue` currency objects (`{currency: 'XRP'}` or
56
+ * `{currency, issuer}`). Our class only verifies `isRecord`, which
57
+ * accepts any object (including `{}` or `{foo: 'bar'}`). The factory
58
+ * uses the local `isXChainBridge` helper to enforce the full shape.
59
+ * - Source: xrpl.js `common.ts` `isXChainBridge` (lines 444–453);
60
+ * `isIssuedCurrency` (lines 282–291).
61
+ * - Source: XLS-38 §2.2.1.1.1 line 322 (`XChainBridge` is required,
62
+ * `XCHAIN_BRIDGE` internal type).
63
+ * - Source: xrpl.org `xchaincreatebridge.md` lines 56–61 (the four
64
+ * sub-fields are each required: `IssuingChainDoor`,
65
+ * `IssuingChainIssue`, `LockingChainDoor`, `LockingChainIssue`).
66
+ * - Cross-ref: our `src/validation/helpers.ts` `isXChainBridge`
67
+ * (lines 168–177) mirrors the xrpl.js check.
68
+ *
69
+ * - **Both `XChainBridge` doors must be valid XRPL classic
70
+ * addresses.** `isXChainBridge` only checks that the door strings
71
+ * are strings; rippled parses them as `STAccount`. The factory
72
+ * additionally runs `isAccount` on each door so a malformed door
73
+ * string is caught at construction. This is especially important
74
+ * for `XChainCreateBridge` because the spec mandates that
75
+ * `Account` (the sender) must match the `LockingChainDoor` on the
76
+ * locking chain and `rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh` is the
77
+ * only valid `IssuingChainDoor` for an XRP-XRP bridge (it must be
78
+ * the genesis account). The factory's door-format check is a
79
+ * preclaim for both fields.
80
+ * - Source: rippled `XChainBridge.cpp` (`sfLockingChainDoor`,
81
+ * `sfIssuingChainDoor` parsed as `STAccount`).
82
+ * - Source: xrpl.org `xchaincreatebridge.md` line 58 (IssuingChainDoor
83
+ * is `AccountID`); line 60 (LockingChainDoor is `AccountID`).
84
+ * - Source: XLS-38 §2.1.1.1.2 lines 175–180 (`XChainBridge`
85
+ * `XCHAIN_BRIDGE` internal type; `LockingChainDoor`,
86
+ * `LockingChainIssue`, `IssuingChainDoor`, `IssuingChainIssue`
87
+ * all required).
88
+ *
89
+ * - **`SignatureReward` must be a non-negative XRP drops string.**
90
+ * XLS-38 §2.1.1.1.3 line 200: "The total amount, **in XRP**, to be
91
+ * rewarded for providing a signature for a cross-chain transfer or
92
+ * for signing for the cross-chain reward. This will be split among
93
+ * the signers." xrpl.org `xchaincreatebridge.md` line 50 lists
94
+ * `SignatureReward` as `Currency Amount`, and the example JSON
95
+ * (line 39) shows `"SignatureReward": 200`. xrpl.js
96
+ * `validateXChainCreateBridge.ts:53` only runs `isAmount`, which
97
+ * accepts any of: XRP drops string, IOU object, or MPT object. The
98
+ * factory enforces XRP-only (drops string) with `≥ 0` (zero is
99
+ * permitted; a bridge may opt out of witness payment). This matches
100
+ * the XLS-38 wording and rippled's `STAmount` parse for
101
+ * `sfSignatureReward` on a bridge object, and mirrors our sibling
102
+ * `xchainAccountCreateCommit` factory.
103
+ * - Source: XLS-38 §2.1.1.1.3 line 200 ("in XRP").
104
+ * - Source: xrpl.org `xchaincreatebridge.md` line 39 (example JSON
105
+ * uses a numeric Amount).
106
+ * - Source: XLS-38 §2.2.1.1.2 line 328 (`SignatureReward` field).
107
+ * - Cross-ref: rippled `XChainBridge.cpp` parses `SignatureReward`
108
+ * as `STAmount` with XRP constraint.
109
+ *
110
+ * - **`MinAccountCreateAmount`, when present, must be a non-negative
111
+ * XRP drops string.** xrpl.org line 49: "The minimum amount, **in
112
+ * XRP**, required for a `XChainAccountCreateCommit` transaction.
113
+ * If this isn't present, the `XChainAccountCreateCommit`
114
+ * transaction will fail. **This field can only be present on
115
+ * XRP-XRP bridges.**" XLS-38 §2.1.1.1.4 line 204 repeats the
116
+ * same. The class accepts any `Amount` (via the `isAmount` helper
117
+ * inherited from the base); xrpl.js's
118
+ * `validateXChainCreateBridge.ts:55` does the same. The factory
119
+ * rejects IOU/MPT forms at construction and additionally rejects
120
+ * non-canonical wire forms (leading zeros, decimals, exponents)
121
+ * to mirror the strict sibling behavior. Optional: when omitted,
122
+ * the bridge is created without a minimum and
123
+ * `XChainAccountCreateCommit` will fail against it.
124
+ * - Source: xrpl.org `xchaincreatebridge.md` line 49 ("in XRP";
125
+ * "can only be present on XRP-XRP bridges").
126
+ * - Source: XLS-38 §2.1.1.1.4 line 204 ("in XRP"; "XRP-XRP
127
+ * bridges only").
128
+ * - Source: XLS-38 §2.2.1.1.3 line 332 (`MinAccountCreateAmount`
129
+ * field).
130
+ * - Cross-ref: rippled `XChainBridge.cpp` parses
131
+ * `MinAccountCreateAmount` as `STAmount` with XRP constraint.
132
+ *
133
+ * - **`Account` should equal `XChainBridge.LockingChainDoor`.** The
134
+ * transaction "must be submitted first by the locking chain door
135
+ * account" per xrpl.org `xchaincreatebridge.md` line 15; the
136
+ * example JSON (lines 28, 30) sets `Account` and
137
+ * `LockingChainDoor` to the same address. The factory enforces this
138
+ * equality at construction. The class does not (it accepts any
139
+ * `Account` shape and leaves the door mismatch to on-ledger
140
+ * rejection). Note: an issuing-chain submission uses the
141
+ * `IssuingChainDoor` instead, but the canonical example shows the
142
+ * locking-side submission; this equality check is therefore a
143
+ * preclaim tightening, not a hard spec rule.
144
+ * - Source: xrpl.org `xchaincreatebridge.md` line 15 ("must be
145
+ * submitted first by the locking chain door account").
146
+ * - Source: xrpl.org example JSON (lines 28, 30) — `Account`
147
+ * equals `LockingChainDoor`.
148
+ * - Cross-ref: rippled `XChainBridge.cpp` preflight checks that
149
+ * `tx[sfAccount]` matches the door account implied by the
150
+ * `XChainBridge` structure; otherwise rejects with `temMALFORMED`.
151
+ *
152
+ * - **`Flags` accepted for parity with the base transaction shape.**
153
+ * XChainCreateBridge defines no transaction-specific flags; only
154
+ * `tfFullyCanonicalSig` (global) is normally meaningful. The class
155
+ * does not declare a `Flags` field. We accept a numeric bitmask
156
+ * for parity with other factories; non-zero flags are stored
157
+ * verbatim. (Documented for awareness; no spec source requires
158
+ * flag rejection.)
159
+ *
160
+ * - **No `Amount` field.** `XChainCreateBridge` does not include an
161
+ * `Amount` field — only `SignatureReward` and the optional
162
+ * `MinAccountCreateAmount`. The factory correctly omits
163
+ * `Amount`/`Destination`. (Sanity note; included to prevent
164
+ * future API drift.)
165
+ * - Source: XLS-38 §2.2.1.1 fields table (lines 316–320); no
166
+ * `Amount` row.
167
+ * - Source: xrpl.org `xchaincreatebridge.md` Fields table
168
+ * (lines 47–51); no `Amount` row.
169
+ */
170
+ import type { XChainBridge } from '../../types/common.js';
171
+ export interface XchainCreateBridgeProps {
172
+ /** The unique address of the transaction sender — the door account
173
+ * on the chain the bridge is being defined on. For a locking-chain
174
+ * submission, this MUST equal `XChainBridge.LockingChainDoor`
175
+ * (xrpl.org line 15, rippled preflight). */
176
+ Account: string;
177
+ /** The bridge (door accounts and assets) to create. Required;
178
+ * must be a fully-shaped `XChainBridge` (4 keys, two valid XRPL
179
+ * doors, two valid Issue forms). */
180
+ XChainBridge: XChainBridge;
181
+ /** The total amount to pay the witness servers for their
182
+ * signatures (XRP drops, ≥ 0). This amount will be split among
183
+ * the signers. */
184
+ SignatureReward: string;
185
+ /** Optional. The minimum amount, in XRP, required for a
186
+ * `XChainAccountCreateCommit` transaction against this bridge.
187
+ * May only be present on XRP-XRP bridges; defaults to 0 when
188
+ * omitted. */
189
+ MinAccountCreateAmount?: string | undefined;
190
+ /** Bit-flags for this transaction. XChainCreateBridge has no
191
+ * defined flags; only `tfFullyCanonicalSig` (global) is meaningful.
192
+ * Accepted for parity with the base tx shape. */
193
+ Flags?: number | undefined;
194
+ /** Fee in drops. */
195
+ Fee?: string | undefined;
196
+ /** Account sequence number. */
197
+ Sequence?: number | undefined;
198
+ }
199
+ export interface XchainCreateBridge extends Readonly<XchainCreateBridgeProps> {
200
+ readonly TransactionType: 'XChainCreateBridge';
201
+ validate(): void;
202
+ toJSON(): Record<string, unknown>;
203
+ with(overrides: Partial<XchainCreateBridgeProps>): XchainCreateBridge;
204
+ }
205
+ export declare function xchainCreateBridge(props: XchainCreateBridgeProps): XchainCreateBridge;
206
+ //# sourceMappingURL=xchain-create-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-create-bridge.d.ts","sourceRoot":"","sources":["../../../src/fp/factories/xchain-create-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAmD1D,MAAM,WAAW,uBAAuB;IACtC;;;iDAG6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;yCAEqC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B;;uBAEmB;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB;;;mBAGe;IACf,sBAAsB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C;;sDAEkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,kBACf,SAAQ,QAAQ,CAAC,uBAAuB,CAAC;IACzC,QAAQ,CAAC,eAAe,EAAE,oBAAoB,CAAC;IAC/C,QAAQ,IAAI,IAAI,CAAC;IACjB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,kBAAkB,CAAC;CACvE;AAID,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAC7B,kBAAkB,CA+EpB"}
@@ -0,0 +1,100 @@
1
+ import { isAccount, isString, isXChainBridge } from '../../validation/helpers.js';
2
+ import { ValidationError } from '../../errors.js';
3
+ import { buildFrozenTx, mergeForWith, require } from '../shape.js';
4
+ // ─── Helpers ─────────────────────────────────────────────────────────
5
+ const XRP_DROPS_REGEX = /^[0-9]+$/u;
6
+ /**
7
+ * Non-negative XRP drops Amount. Accepts canonical XRP drops mantissa
8
+ * form (decimal integer string with no exponent, no decimal point —
9
+ * the wire format used by Amount fields in XChainBridge-related
10
+ * transactions) and rejects zero, negative, and non-numeric values
11
+ * via the strictly-positive wrapper.
12
+ *
13
+ * For XChainCreateBridge, both `SignatureReward` and
14
+ * `MinAccountCreateAmount` may legitimately be `'0'` (a bridge may
15
+ * opt out of witness payment; `MinAccountCreateAmount` defaults to 0
16
+ * when omitted). Zero is therefore allowed.
17
+ */
18
+ function isNonNegativeXrpAmount(value) {
19
+ if (!isString(value))
20
+ return false;
21
+ if (!XRP_DROPS_REGEX.test(value))
22
+ return false;
23
+ // Reject leading zeros (e.g., '01', '00100') — the XRPL wire format
24
+ // rejects these. `'0'` itself is the only valid zero.
25
+ if (value.length > 1 && value.startsWith('0'))
26
+ return false;
27
+ return true;
28
+ }
29
+ /**
30
+ * Validate XChainBridge object shape: 4 keys with both doors as valid
31
+ * XRPL classic/X addresses and both issues as valid Issue forms. The
32
+ * local `isXChainBridge` helper checks the structural 4-key + Issue
33
+ * shape; we add XRPL-account format validation on the two doors.
34
+ */
35
+ function assertValidXChainBridge(bridge) {
36
+ if (!isAccount(bridge.LockingChainDoor)) {
37
+ throw new ValidationError('XChainCreateBridge: XChainBridge.LockingChainDoor must be a valid XRPL account address');
38
+ }
39
+ if (!isAccount(bridge.IssuingChainDoor)) {
40
+ throw new ValidationError('XChainCreateBridge: XChainBridge.IssuingChainDoor must be a valid XRPL account address');
41
+ }
42
+ }
43
+ // ─── Factory ─────────────────────────────────────────────────────────
44
+ export function xchainCreateBridge(props) {
45
+ // ── Account ── required, must be a valid XRPL classic or X-address.
46
+ require(props.Account, 'XChainCreateBridge: Account is required', isAccount);
47
+ // ── XChainBridge ── required, full shape (4 keys, both doors valid
48
+ // XRPL accounts, both issues valid Issue forms). The factory
49
+ // uses the local `isXChainBridge` helper for the structural
50
+ // shape (see validation/helpers.ts lines 168–177) and
51
+ // additionally verifies the door strings are valid XRPL accounts.
52
+ require(props.XChainBridge, 'XChainCreateBridge: XChainBridge is required and must have shape {LockingChainDoor, LockingChainIssue, IssuingChainDoor, IssuingChainIssue}', isXChainBridge);
53
+ // `props.XChainBridge` is now type-narrowed to XChainBridge —
54
+ // verify the doors are valid XRPL accounts (the helper only
55
+ // checks `typeof === 'string'`).
56
+ assertValidXChainBridge(props.XChainBridge);
57
+ // ── Account must equal LockingChainDoor (locking-chain submission).
58
+ // xrpl.org line 15: "The transaction must be submitted first by
59
+ // the locking chain door account." The example JSON shows
60
+ // `Account === LockingChainDoor`. (For an issuing-chain
61
+ // submission the analogous preflight uses IssuingChainDoor; we
62
+ // do not enforce that case here — see Spec Ambiguities #3.)
63
+ if (props.Account !== props.XChainBridge.LockingChainDoor) {
64
+ throw new ValidationError('XChainCreateBridge: Account must equal XChainBridge.LockingChainDoor (transaction must be submitted by the locking-chain door account)');
65
+ }
66
+ // ── SignatureReward ── required, non-negative XRP drops string.
67
+ if (!isNonNegativeXrpAmount(props.SignatureReward)) {
68
+ throw new ValidationError('XChainCreateBridge: SignatureReward must be a non-negative XRP drops string (in XRP, ≥ 0; XLS-38 §2.1.1.1.3 line 200)');
69
+ }
70
+ // ── MinAccountCreateAmount ── optional. When present, must be a
71
+ // non-negative XRP drops string. The spec limits this field to
72
+ // XRP-XRP bridges (xrpl.org line 49 / XLS-38 §2.1.1.1.4 line
73
+ // 204). We do not detect IOU-IOU bridges here; the IOU form of
74
+ // the amount is rejected by the XRP-drops format check.
75
+ if (props.MinAccountCreateAmount !== undefined) {
76
+ if (!isNonNegativeXrpAmount(props.MinAccountCreateAmount)) {
77
+ throw new ValidationError('XChainCreateBridge: MinAccountCreateAmount must be a non-negative XRP drops string (in XRP, ≥ 0; XRP-XRP bridges only — xrpl.org line 49)');
78
+ }
79
+ }
80
+ return buildFrozenTx('XChainCreateBridge', props, {
81
+ validate() {
82
+ // Validated at construction.
83
+ },
84
+ toJSON() {
85
+ const json = {};
86
+ for (const k of Object.keys(this)) {
87
+ if (k === 'validate' || k === 'toJSON' || k === 'with')
88
+ continue;
89
+ const v = this[k];
90
+ if (v !== undefined)
91
+ json[k] = v;
92
+ }
93
+ return json;
94
+ },
95
+ with(overrides) {
96
+ return xchainCreateBridge(mergeForWith(this, overrides));
97
+ },
98
+ });
99
+ }
100
+ //# sourceMappingURL=xchain-create-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xchain-create-bridge.js","sourceRoot":"","sources":["../../../src/fp/factories/xchain-create-bridge.ts"],"names":[],"mappings":"AA0KA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEnE,wEAAwE;AAExE,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,SAAS,sBAAsB,CAAC,KAAc;IAC5C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,oEAAoE;IACpE,sDAAsD;IACtD,IAAI,KAAK,CA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