xrpl 2.13.0 → 3.0.0-beta.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 (334) hide show
  1. package/README.md +2 -2
  2. package/build/xrpl-latest-min.js +1 -1
  3. package/build/xrpl-latest-min.js.map +1 -1
  4. package/build/xrpl-latest.js +18279 -74867
  5. package/build/xrpl-latest.js.map +1 -1
  6. package/dist/npm/Wallet/authorizeChannel.d.ts +3 -0
  7. package/dist/npm/Wallet/authorizeChannel.d.ts.map +1 -0
  8. package/dist/npm/Wallet/authorizeChannel.js +14 -0
  9. package/dist/npm/Wallet/authorizeChannel.js.map +1 -0
  10. package/dist/npm/Wallet/defaultFaucets.js +1 -1
  11. package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
  12. package/dist/npm/Wallet/fundWallet.d.ts +17 -3
  13. package/dist/npm/Wallet/fundWallet.d.ts.map +1 -1
  14. package/dist/npm/Wallet/fundWallet.js +53 -78
  15. package/dist/npm/Wallet/fundWallet.js.map +1 -1
  16. package/dist/npm/Wallet/index.d.ts.map +1 -1
  17. package/dist/npm/Wallet/index.js +24 -23
  18. package/dist/npm/Wallet/index.js.map +1 -1
  19. package/dist/npm/Wallet/signer.d.ts +2 -4
  20. package/dist/npm/Wallet/signer.d.ts.map +1 -1
  21. package/dist/npm/Wallet/signer.js +17 -13
  22. package/dist/npm/Wallet/signer.js.map +1 -1
  23. package/dist/npm/Wallet/walletFromSecretNumbers.js +2 -2
  24. package/dist/npm/Wallet/walletFromSecretNumbers.js.map +1 -1
  25. package/dist/npm/client/RequestManager.d.ts +3 -2
  26. package/dist/npm/client/RequestManager.d.ts.map +1 -1
  27. package/dist/npm/client/RequestManager.js +25 -1
  28. package/dist/npm/client/RequestManager.js.map +1 -1
  29. package/dist/npm/client/connection.d.ts +8 -11
  30. package/dist/npm/client/connection.d.ts.map +1 -1
  31. package/dist/npm/client/connection.js +8 -54
  32. package/dist/npm/client/connection.js.map +1 -1
  33. package/dist/npm/client/index.d.ts +56 -78
  34. package/dist/npm/client/index.d.ts.map +1 -1
  35. package/dist/npm/client/index.js +155 -42
  36. package/dist/npm/client/index.js.map +1 -1
  37. package/dist/npm/client/partialPayment.d.ts +4 -2
  38. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  39. package/dist/npm/client/partialPayment.js.map +1 -1
  40. package/dist/npm/errors.d.ts.map +1 -1
  41. package/dist/npm/errors.js +1 -2
  42. package/dist/npm/errors.js.map +1 -1
  43. package/dist/npm/index.d.ts +1 -1
  44. package/dist/npm/index.d.ts.map +1 -1
  45. package/dist/npm/index.js +1 -3
  46. package/dist/npm/index.js.map +1 -1
  47. package/dist/npm/models/ledger/AccountRoot.js +1 -1
  48. package/dist/npm/models/ledger/AccountRoot.js.map +1 -1
  49. package/dist/npm/models/ledger/Offer.js +1 -1
  50. package/dist/npm/models/ledger/Offer.js.map +1 -1
  51. package/dist/npm/models/ledger/RippleState.js +1 -1
  52. package/dist/npm/models/ledger/RippleState.js.map +1 -1
  53. package/dist/npm/models/ledger/SignerList.js +1 -1
  54. package/dist/npm/models/ledger/SignerList.js.map +1 -1
  55. package/dist/npm/models/methods/index.d.ts +12 -1
  56. package/dist/npm/models/methods/index.d.ts.map +1 -1
  57. package/dist/npm/models/methods/ledger.d.ts +35 -7
  58. package/dist/npm/models/methods/ledger.d.ts.map +1 -1
  59. package/dist/npm/models/methods/subscribe.d.ts +3 -0
  60. package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
  61. package/dist/npm/models/methods/tx.d.ts +1 -1
  62. package/dist/npm/models/methods/tx.d.ts.map +1 -1
  63. package/dist/npm/models/transactions/AMMDeposit.js +1 -1
  64. package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
  65. package/dist/npm/models/transactions/AMMWithdraw.js +1 -1
  66. package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
  67. package/dist/npm/models/transactions/NFTokenAcceptOffer.d.ts +4 -0
  68. package/dist/npm/models/transactions/NFTokenAcceptOffer.d.ts.map +1 -1
  69. package/dist/npm/models/transactions/NFTokenAcceptOffer.js.map +1 -1
  70. package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts +4 -0
  71. package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  72. package/dist/npm/models/transactions/NFTokenCancelOffer.js.map +1 -1
  73. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts +4 -0
  74. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  75. package/dist/npm/models/transactions/NFTokenCreateOffer.js +1 -1
  76. package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
  77. package/dist/npm/models/transactions/NFTokenMint.d.ts +4 -0
  78. package/dist/npm/models/transactions/NFTokenMint.d.ts.map +1 -1
  79. package/dist/npm/models/transactions/NFTokenMint.js +1 -1
  80. package/dist/npm/models/transactions/NFTokenMint.js.map +1 -1
  81. package/dist/npm/models/transactions/XChainModifyBridge.js +1 -1
  82. package/dist/npm/models/transactions/XChainModifyBridge.js.map +1 -1
  83. package/dist/npm/models/transactions/accountSet.js +2 -2
  84. package/dist/npm/models/transactions/accountSet.js.map +1 -1
  85. package/dist/npm/models/transactions/enableAmendment.js +1 -1
  86. package/dist/npm/models/transactions/enableAmendment.js.map +1 -1
  87. package/dist/npm/models/transactions/metadata.d.ts +9 -1
  88. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  89. package/dist/npm/models/transactions/metadata.js.map +1 -1
  90. package/dist/npm/models/transactions/offerCreate.js +1 -1
  91. package/dist/npm/models/transactions/offerCreate.js.map +1 -1
  92. package/dist/npm/models/transactions/payment.d.ts +5 -0
  93. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  94. package/dist/npm/models/transactions/payment.js +1 -1
  95. package/dist/npm/models/transactions/payment.js.map +1 -1
  96. package/dist/npm/models/transactions/paymentChannelClaim.js +1 -1
  97. package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
  98. package/dist/npm/models/transactions/transaction.d.ts +4 -3
  99. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  100. package/dist/npm/models/transactions/transaction.js.map +1 -1
  101. package/dist/npm/models/transactions/trustSet.js +1 -1
  102. package/dist/npm/models/transactions/trustSet.js.map +1 -1
  103. package/dist/npm/snippets/src/getTransaction.js +1 -1
  104. package/dist/npm/snippets/src/getTransaction.js.map +1 -1
  105. package/dist/npm/snippets/src/paths.js +2 -3
  106. package/dist/npm/snippets/src/paths.js.map +1 -1
  107. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  108. package/dist/npm/src/Wallet/authorizeChannel.d.ts +3 -0
  109. package/dist/npm/src/Wallet/authorizeChannel.d.ts.map +1 -0
  110. package/dist/npm/src/Wallet/authorizeChannel.js +14 -0
  111. package/dist/npm/src/Wallet/authorizeChannel.js.map +1 -0
  112. package/dist/npm/src/Wallet/defaultFaucets.js +1 -1
  113. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  114. package/dist/npm/src/Wallet/fundWallet.d.ts +17 -3
  115. package/dist/npm/src/Wallet/fundWallet.d.ts.map +1 -1
  116. package/dist/npm/src/Wallet/fundWallet.js +53 -78
  117. package/dist/npm/src/Wallet/fundWallet.js.map +1 -1
  118. package/dist/npm/src/Wallet/index.d.ts.map +1 -1
  119. package/dist/npm/src/Wallet/index.js +24 -23
  120. package/dist/npm/src/Wallet/index.js.map +1 -1
  121. package/dist/npm/src/Wallet/signer.d.ts +2 -4
  122. package/dist/npm/src/Wallet/signer.d.ts.map +1 -1
  123. package/dist/npm/src/Wallet/signer.js +17 -13
  124. package/dist/npm/src/Wallet/signer.js.map +1 -1
  125. package/dist/npm/src/Wallet/walletFromSecretNumbers.js +2 -2
  126. package/dist/npm/src/Wallet/walletFromSecretNumbers.js.map +1 -1
  127. package/dist/npm/src/client/RequestManager.d.ts +3 -2
  128. package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
  129. package/dist/npm/src/client/RequestManager.js +25 -1
  130. package/dist/npm/src/client/RequestManager.js.map +1 -1
  131. package/dist/npm/src/client/connection.d.ts +8 -11
  132. package/dist/npm/src/client/connection.d.ts.map +1 -1
  133. package/dist/npm/src/client/connection.js +8 -54
  134. package/dist/npm/src/client/connection.js.map +1 -1
  135. package/dist/npm/src/client/index.d.ts +56 -78
  136. package/dist/npm/src/client/index.d.ts.map +1 -1
  137. package/dist/npm/src/client/index.js +155 -42
  138. package/dist/npm/src/client/index.js.map +1 -1
  139. package/dist/npm/src/client/partialPayment.d.ts +4 -2
  140. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  141. package/dist/npm/src/client/partialPayment.js.map +1 -1
  142. package/dist/npm/src/errors.d.ts.map +1 -1
  143. package/dist/npm/src/errors.js +1 -2
  144. package/dist/npm/src/errors.js.map +1 -1
  145. package/dist/npm/src/index.d.ts +1 -1
  146. package/dist/npm/src/index.d.ts.map +1 -1
  147. package/dist/npm/src/index.js +1 -3
  148. package/dist/npm/src/index.js.map +1 -1
  149. package/dist/npm/src/models/ledger/AccountRoot.js +1 -1
  150. package/dist/npm/src/models/ledger/AccountRoot.js.map +1 -1
  151. package/dist/npm/src/models/ledger/Offer.js +1 -1
  152. package/dist/npm/src/models/ledger/Offer.js.map +1 -1
  153. package/dist/npm/src/models/ledger/RippleState.js +1 -1
  154. package/dist/npm/src/models/ledger/RippleState.js.map +1 -1
  155. package/dist/npm/src/models/ledger/SignerList.js +1 -1
  156. package/dist/npm/src/models/ledger/SignerList.js.map +1 -1
  157. package/dist/npm/src/models/methods/index.d.ts +12 -1
  158. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  159. package/dist/npm/src/models/methods/ledger.d.ts +35 -7
  160. package/dist/npm/src/models/methods/ledger.d.ts.map +1 -1
  161. package/dist/npm/src/models/methods/subscribe.d.ts +3 -0
  162. package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
  163. package/dist/npm/src/models/methods/tx.d.ts +1 -1
  164. package/dist/npm/src/models/methods/tx.d.ts.map +1 -1
  165. package/dist/npm/src/models/transactions/AMMDeposit.js +1 -1
  166. package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
  167. package/dist/npm/src/models/transactions/AMMWithdraw.js +1 -1
  168. package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
  169. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.d.ts +4 -0
  170. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.d.ts.map +1 -1
  171. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.js.map +1 -1
  172. package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts +4 -0
  173. package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  174. package/dist/npm/src/models/transactions/NFTokenCancelOffer.js.map +1 -1
  175. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts +4 -0
  176. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  177. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js +1 -1
  178. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js.map +1 -1
  179. package/dist/npm/src/models/transactions/NFTokenMint.d.ts +4 -0
  180. package/dist/npm/src/models/transactions/NFTokenMint.d.ts.map +1 -1
  181. package/dist/npm/src/models/transactions/NFTokenMint.js +1 -1
  182. package/dist/npm/src/models/transactions/NFTokenMint.js.map +1 -1
  183. package/dist/npm/src/models/transactions/XChainModifyBridge.js +1 -1
  184. package/dist/npm/src/models/transactions/XChainModifyBridge.js.map +1 -1
  185. package/dist/npm/src/models/transactions/accountSet.js +2 -2
  186. package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
  187. package/dist/npm/src/models/transactions/enableAmendment.js +1 -1
  188. package/dist/npm/src/models/transactions/enableAmendment.js.map +1 -1
  189. package/dist/npm/src/models/transactions/metadata.d.ts +9 -1
  190. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  191. package/dist/npm/src/models/transactions/metadata.js.map +1 -1
  192. package/dist/npm/src/models/transactions/offerCreate.js +1 -1
  193. package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
  194. package/dist/npm/src/models/transactions/payment.d.ts +5 -0
  195. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  196. package/dist/npm/src/models/transactions/payment.js +1 -1
  197. package/dist/npm/src/models/transactions/payment.js.map +1 -1
  198. package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -1
  199. package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
  200. package/dist/npm/src/models/transactions/transaction.d.ts +4 -3
  201. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  202. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  203. package/dist/npm/src/models/transactions/trustSet.js +1 -1
  204. package/dist/npm/src/models/transactions/trustSet.js.map +1 -1
  205. package/dist/npm/src/sugar/autofill.d.ts +6 -2
  206. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  207. package/dist/npm/src/sugar/autofill.js +9 -28
  208. package/dist/npm/src/sugar/autofill.js.map +1 -1
  209. package/dist/npm/src/sugar/balances.d.ts +2 -17
  210. package/dist/npm/src/sugar/balances.d.ts.map +1 -1
  211. package/dist/npm/src/sugar/balances.js +2 -60
  212. package/dist/npm/src/sugar/balances.js.map +1 -1
  213. package/dist/npm/src/sugar/getOrderbook.d.ts +19 -5
  214. package/dist/npm/src/sugar/getOrderbook.d.ts.map +1 -1
  215. package/dist/npm/src/sugar/getOrderbook.js +72 -53
  216. package/dist/npm/src/sugar/getOrderbook.js.map +1 -1
  217. package/dist/npm/src/sugar/index.d.ts +0 -4
  218. package/dist/npm/src/sugar/index.d.ts.map +1 -1
  219. package/dist/npm/src/sugar/index.js +0 -13
  220. package/dist/npm/src/sugar/index.js.map +1 -1
  221. package/dist/npm/src/sugar/submit.d.ts +6 -9
  222. package/dist/npm/src/sugar/submit.d.ts.map +1 -1
  223. package/dist/npm/src/sugar/submit.js +5 -22
  224. package/dist/npm/src/sugar/submit.js.map +1 -1
  225. package/dist/npm/src/utils/collections.d.ts +7 -0
  226. package/dist/npm/src/utils/collections.d.ts.map +1 -0
  227. package/dist/npm/src/utils/collections.js +22 -0
  228. package/dist/npm/src/utils/collections.js.map +1 -0
  229. package/dist/npm/src/utils/getBalanceChanges.d.ts.map +1 -1
  230. package/dist/npm/src/utils/getBalanceChanges.js +3 -4
  231. package/dist/npm/src/utils/getBalanceChanges.js.map +1 -1
  232. package/dist/npm/src/utils/getNFTokenID.d.ts.map +1 -1
  233. package/dist/npm/src/utils/getNFTokenID.js +8 -8
  234. package/dist/npm/src/utils/getNFTokenID.js.map +1 -1
  235. package/dist/npm/src/utils/hashes/SHAMap/node.js +1 -1
  236. package/dist/npm/src/utils/hashes/SHAMap/node.js.map +1 -1
  237. package/dist/npm/src/utils/hashes/sha512Half.d.ts.map +1 -1
  238. package/dist/npm/src/utils/hashes/sha512Half.js +4 -7
  239. package/dist/npm/src/utils/hashes/sha512Half.js.map +1 -1
  240. package/dist/npm/sugar/autofill.d.ts +6 -2
  241. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  242. package/dist/npm/sugar/autofill.js +9 -28
  243. package/dist/npm/sugar/autofill.js.map +1 -1
  244. package/dist/npm/sugar/balances.d.ts +2 -17
  245. package/dist/npm/sugar/balances.d.ts.map +1 -1
  246. package/dist/npm/sugar/balances.js +2 -60
  247. package/dist/npm/sugar/balances.js.map +1 -1
  248. package/dist/npm/sugar/getOrderbook.d.ts +19 -5
  249. package/dist/npm/sugar/getOrderbook.d.ts.map +1 -1
  250. package/dist/npm/sugar/getOrderbook.js +72 -53
  251. package/dist/npm/sugar/getOrderbook.js.map +1 -1
  252. package/dist/npm/sugar/index.d.ts +0 -4
  253. package/dist/npm/sugar/index.d.ts.map +1 -1
  254. package/dist/npm/sugar/index.js +0 -13
  255. package/dist/npm/sugar/index.js.map +1 -1
  256. package/dist/npm/sugar/submit.d.ts +6 -9
  257. package/dist/npm/sugar/submit.d.ts.map +1 -1
  258. package/dist/npm/sugar/submit.js +5 -22
  259. package/dist/npm/sugar/submit.js.map +1 -1
  260. package/dist/npm/utils/collections.d.ts +7 -0
  261. package/dist/npm/utils/collections.d.ts.map +1 -0
  262. package/dist/npm/utils/collections.js +22 -0
  263. package/dist/npm/utils/collections.js.map +1 -0
  264. package/dist/npm/utils/getBalanceChanges.d.ts.map +1 -1
  265. package/dist/npm/utils/getBalanceChanges.js +3 -4
  266. package/dist/npm/utils/getBalanceChanges.js.map +1 -1
  267. package/dist/npm/utils/getNFTokenID.d.ts.map +1 -1
  268. package/dist/npm/utils/getNFTokenID.js +8 -8
  269. package/dist/npm/utils/getNFTokenID.js.map +1 -1
  270. package/dist/npm/utils/hashes/SHAMap/node.js +1 -1
  271. package/dist/npm/utils/hashes/SHAMap/node.js.map +1 -1
  272. package/dist/npm/utils/hashes/sha512Half.d.ts.map +1 -1
  273. package/dist/npm/utils/hashes/sha512Half.js +4 -7
  274. package/dist/npm/utils/hashes/sha512Half.js.map +1 -1
  275. package/package.json +23 -25
  276. package/src/Wallet/authorizeChannel.ts +26 -0
  277. package/src/Wallet/fundWallet.ts +151 -212
  278. package/src/Wallet/index.ts +28 -25
  279. package/src/Wallet/signer.ts +32 -43
  280. package/src/Wallet/walletFromSecretNumbers.ts +1 -1
  281. package/src/client/RequestManager.ts +40 -14
  282. package/src/client/connection.ts +20 -89
  283. package/src/client/index.ts +704 -269
  284. package/src/client/partialPayment.ts +14 -8
  285. package/src/errors.ts +1 -3
  286. package/src/index.ts +1 -3
  287. package/src/models/ledger/Ledger.ts +1 -1
  288. package/src/models/methods/index.ts +175 -0
  289. package/src/models/methods/ledger.ts +149 -20
  290. package/src/models/methods/subscribe.ts +36 -0
  291. package/src/models/methods/tx.ts +2 -1
  292. package/src/models/transactions/NFTokenAcceptOffer.ts +6 -0
  293. package/src/models/transactions/NFTokenCancelOffer.ts +6 -0
  294. package/src/models/transactions/NFTokenCreateOffer.ts +6 -0
  295. package/src/models/transactions/NFTokenMint.ts +6 -0
  296. package/src/models/transactions/metadata.ts +31 -1
  297. package/src/models/transactions/payment.ts +6 -0
  298. package/src/models/transactions/transaction.ts +6 -4
  299. package/src/sugar/autofill.ts +84 -88
  300. package/src/sugar/balances.ts +8 -116
  301. package/src/sugar/getOrderbook.ts +138 -61
  302. package/src/sugar/index.ts +0 -8
  303. package/src/sugar/submit.ts +114 -132
  304. package/src/utils/collections.ts +53 -0
  305. package/src/utils/getBalanceChanges.ts +2 -3
  306. package/src/utils/getNFTokenID.ts +18 -16
  307. package/src/utils/hashes/sha512Half.ts +4 -7
  308. package/dist/npm/client/BroadcastClient.d.ts +0 -7
  309. package/dist/npm/client/BroadcastClient.d.ts.map +0 -1
  310. package/dist/npm/client/BroadcastClient.js +0 -49
  311. package/dist/npm/client/BroadcastClient.js.map +0 -1
  312. package/dist/npm/client/WSWrapper.d.ts +0 -25
  313. package/dist/npm/client/WSWrapper.d.ts.map +0 -1
  314. package/dist/npm/client/WSWrapper.js +0 -44
  315. package/dist/npm/client/WSWrapper.js.map +0 -1
  316. package/dist/npm/src/client/BroadcastClient.d.ts +0 -7
  317. package/dist/npm/src/client/BroadcastClient.d.ts.map +0 -1
  318. package/dist/npm/src/client/BroadcastClient.js +0 -49
  319. package/dist/npm/src/client/BroadcastClient.js.map +0 -1
  320. package/dist/npm/src/client/WSWrapper.d.ts +0 -25
  321. package/dist/npm/src/client/WSWrapper.d.ts.map +0 -1
  322. package/dist/npm/src/client/WSWrapper.js +0 -44
  323. package/dist/npm/src/client/WSWrapper.js.map +0 -1
  324. package/dist/npm/src/sugar/getLedgerIndex.d.ts +0 -3
  325. package/dist/npm/src/sugar/getLedgerIndex.d.ts.map +0 -1
  326. package/dist/npm/src/sugar/getLedgerIndex.js +0 -22
  327. package/dist/npm/src/sugar/getLedgerIndex.js.map +0 -1
  328. package/dist/npm/sugar/getLedgerIndex.d.ts +0 -3
  329. package/dist/npm/sugar/getLedgerIndex.d.ts.map +0 -1
  330. package/dist/npm/sugar/getLedgerIndex.js +0 -22
  331. package/dist/npm/sugar/getLedgerIndex.js.map +0 -1
  332. package/src/client/BroadcastClient.ts +0 -84
  333. package/src/client/WSWrapper.ts +0 -106
  334. package/src/sugar/getLedgerIndex.ts +0 -15
@@ -3,13 +3,13 @@ import { decode } from 'ripple-binary-codec'
3
3
 
4
4
  import type {
5
5
  AccountTxResponse,
6
- Response,
7
- ResponseWarning,
8
6
  TransactionEntryResponse,
9
7
  TransactionStream,
10
8
  TxResponse,
11
9
  } from '..'
12
10
  import type { Amount } from '../models/common'
11
+ import type { RequestResponseMap } from '../models/methods'
12
+ import { BaseRequest, BaseResponse } from '../models/methods/baseMethod'
13
13
  import {
14
14
  PaymentFlags,
15
15
  PseudoTransaction,
@@ -90,7 +90,10 @@ function accountTxHasPartialPayment(response: AccountTxResponse): boolean {
90
90
  return foo
91
91
  }
92
92
 
93
- function hasPartialPayment(command: string, response: Response): boolean {
93
+ function hasPartialPayment<R extends BaseRequest, T = RequestResponseMap<R>>(
94
+ command: string,
95
+ response: T,
96
+ ): boolean {
94
97
  /* eslint-disable @typescript-eslint/consistent-type-assertions -- Request type is known at runtime from command */
95
98
  switch (command) {
96
99
  case 'tx':
@@ -111,12 +114,13 @@ function hasPartialPayment(command: string, response: Response): boolean {
111
114
  * @param command - Command from the request, tells us what response to expect.
112
115
  * @param response - Response to check for a partial payment.
113
116
  */
114
- export function handlePartialPayment(
115
- command: string,
116
- response: Response,
117
- ): void {
117
+ export function handlePartialPayment<
118
+ R extends BaseRequest,
119
+ T = RequestResponseMap<R>,
120
+ >(command: string, response: T): void {
118
121
  if (hasPartialPayment(command, response)) {
119
- const warnings: ResponseWarning[] = response.warnings ?? []
122
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We are checking dynamically and safely.
123
+ const warnings = (response as BaseResponse).warnings ?? []
120
124
 
121
125
  const warning = {
122
126
  id: WARN_PARTIAL_PAYMENT_CODE,
@@ -125,6 +129,8 @@ export function handlePartialPayment(
125
129
 
126
130
  warnings.push(warning)
127
131
 
132
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- We are checking dynamically and safely.
133
+ // @ts-expect-error -- We are checking dynamically and safely.
128
134
  response.warnings = warnings
129
135
  }
130
136
  }
package/src/errors.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  /* eslint-disable max-classes-per-file -- Errors can be defined in the same file */
2
- import { inspect } from 'util'
3
-
4
2
  /**
5
3
  * Base Error class for xrpl.js. All Errors thrown by xrpl.js should throw
6
4
  * XrplErrors.
@@ -38,7 +36,7 @@ class XrplError extends Error {
38
36
  public toString(): string {
39
37
  let result = `[${this.name}(${this.message}`
40
38
  if (this.data) {
41
- result += `, ${inspect(this.data)}`
39
+ result += `, ${JSON.stringify(this.data)}`
42
40
  }
43
41
  result += ')]'
44
42
  return result
package/src/index.ts CHANGED
@@ -1,6 +1,3 @@
1
- // Broadcast client is experimental
2
- export { BroadcastClient } from './client/BroadcastClient'
3
-
4
1
  export { Client, ClientOptions } from './client'
5
2
 
6
3
  export * from './models'
@@ -11,6 +8,7 @@ export { default as ECDSA } from './ECDSA'
11
8
 
12
9
  export * from './errors'
13
10
 
11
+ export { FundingOptions } from './Wallet/fundWallet'
14
12
  export { Wallet } from './Wallet'
15
13
 
16
14
  export { walletFromSecretNumbers } from './Wallet/walletFromSecretNumbers'
@@ -15,7 +15,7 @@ import { LedgerEntry } from './LedgerEntry'
15
15
  export default interface Ledger {
16
16
  /** The SHA-512Half of this ledger's state tree information. */
17
17
  account_hash: string
18
- /** All the state information in this ledger. */
18
+ /** All the state information in this ledger. Admin only. */
19
19
  accountState?: LedgerEntry[]
20
20
  /** A bit-map of flags relating to the closing of this ledger. */
21
21
  close_flags: number
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-inline-comments -- Necessary for important note */
1
2
  /* eslint-disable max-lines -- There is a lot to export */
2
3
  import {
3
4
  AccountChannelsRequest,
@@ -71,6 +72,11 @@ import {
71
72
  LedgerQueueData,
72
73
  LedgerRequest,
73
74
  LedgerResponse,
75
+ LedgerRequestExpandedTransactionsOnly,
76
+ LedgerResponseExpanded,
77
+ LedgerRequestExpandedAccountsAndTransactions,
78
+ LedgerRequestExpandedAccountsOnly,
79
+ LedgerRequestExpandedTransactionsBinary,
74
80
  } from './ledger'
75
81
  import { LedgerClosedRequest, LedgerClosedResponse } from './ledgerClosed'
76
82
  import { LedgerCurrentRequest, LedgerCurrentResponse } from './ledgerCurrent'
@@ -253,6 +259,175 @@ type Response =
253
259
  // AMM methods
254
260
  | AMMInfoResponse
255
261
 
262
+ export type RequestResponseMap<T> = T extends AccountChannelsRequest
263
+ ? AccountChannelsResponse
264
+ : T extends AccountCurrenciesRequest
265
+ ? AccountCurrenciesResponse
266
+ : T extends AccountInfoRequest
267
+ ? AccountInfoResponse
268
+ : T extends AccountLinesRequest
269
+ ? AccountLinesResponse
270
+ : T extends AccountNFTsRequest
271
+ ? AccountNFTsResponse
272
+ : T extends AccountObjectsRequest
273
+ ? AccountObjectsResponse
274
+ : T extends AccountOffersRequest
275
+ ? AccountOffersResponse
276
+ : T extends AccountTxRequest
277
+ ? AccountTxResponse
278
+ : T extends AMMInfoRequest
279
+ ? AMMInfoResponse
280
+ : T extends GatewayBalancesRequest
281
+ ? GatewayBalancesResponse
282
+ : T extends NoRippleCheckRequest
283
+ ? NoRippleCheckResponse
284
+ : // NOTE: The order of these LedgerRequest types is important
285
+ // to get the proper type matching overrides based on parameters set
286
+ // in the request. For example LedgerRequestExpandedTransactionsBinary
287
+ // should match LedgerRequestExpandedTransactionsOnly, but not
288
+ // LedgerRequestExpandedAccountsOnly. This is because the
289
+ // LedgerRequestExpandedTransactionsBinary type is a superset of
290
+ // LedgerRequestExpandedTransactionsOnly, but not of the other.
291
+ // This is why LedgerRequestExpandedTransactionsBinary is listed
292
+ // first in the type list.
293
+ //
294
+ // Here is an example using real data:
295
+ // LedgerRequestExpandedTransactionsBinary = {
296
+ // command: 'ledger',
297
+ // ledger_index: 'validated',
298
+ // expand: true,
299
+ // transactions: true,
300
+ // binary: true,
301
+ // }
302
+ // LedgerRequestExpandedTransactionsOnly = {
303
+ // command: 'ledger',
304
+ // ledger_index: 'validated',
305
+ // expand: true,
306
+ // transactions: true,
307
+ // }
308
+ // LedgerRequestExpandedAccountsOnly = {
309
+ // command: 'ledger',
310
+ // ledger_index: 'validated',
311
+ // accounts: true,
312
+ // expand: true,
313
+ // }
314
+ // LedgerRequest = {
315
+ // command: 'ledger',
316
+ // ledger_index: 'validated',
317
+ // }
318
+ //
319
+ // The type with the most parameters set should be listed first. In this
320
+ // case LedgerRequestExpandedTransactionsBinary has the most parameters (`expand`, `transactions`, and `binary`)
321
+ // set, so it is listed first. When TypeScript tries to match the type of
322
+ // a request to a response, it will try to match the request type to the
323
+ // response type in the order they are listed. So, if we have a request
324
+ // with the following parameters:
325
+ // {
326
+ // command: 'ledger',
327
+ // ledger_index: 'validated',
328
+ // expand: true,
329
+ // transactions: true,
330
+ // binary: true,
331
+ // }
332
+ // TypeScript will first try to match the request type to
333
+ // LedgerRequestExpandedTransactionsBinary, which will succeed. It will
334
+ // then try to match the response type to LedgerResponseExpanded, which
335
+ // will also succeed. If we had listed LedgerRequestExpandedTransactionsOnly
336
+ // first, TypeScript would have tried to match the request type to
337
+ // LedgerRequestExpandedTransactionsOnly, which would have succeeded, but
338
+ // then we'd get the wrong response type, LedgerResponse, instead of
339
+ // LedgerResponseExpanded.
340
+ T extends LedgerRequestExpandedTransactionsBinary
341
+ ? LedgerResponse
342
+ : T extends LedgerRequestExpandedAccountsAndTransactions
343
+ ? LedgerResponseExpanded
344
+ : T extends LedgerRequestExpandedTransactionsOnly
345
+ ? LedgerResponseExpanded
346
+ : T extends LedgerRequestExpandedAccountsOnly
347
+ ? LedgerResponseExpanded
348
+ : T extends LedgerRequest
349
+ ? LedgerResponse
350
+ : T extends LedgerClosedRequest
351
+ ? LedgerClosedResponse
352
+ : T extends LedgerCurrentRequest
353
+ ? LedgerCurrentResponse
354
+ : T extends LedgerDataRequest
355
+ ? LedgerDataResponse
356
+ : T extends LedgerEntryRequest
357
+ ? LedgerEntryResponse
358
+ : T extends SubmitRequest
359
+ ? SubmitResponse
360
+ : T extends SubmitMultisignedRequest
361
+ ? SubmitMultisignedResponse
362
+ : T extends TransactionEntryRequest
363
+ ? TransactionEntryResponse
364
+ : T extends TxRequest
365
+ ? TxResponse
366
+ : T extends BookOffersRequest
367
+ ? BookOffersResponse
368
+ : T extends DepositAuthorizedRequest
369
+ ? DepositAuthorizedResponse
370
+ : T extends PathFindRequest
371
+ ? PathFindResponse
372
+ : T extends RipplePathFindRequest
373
+ ? RipplePathFindResponse
374
+ : T extends ChannelVerifyRequest
375
+ ? ChannelVerifyResponse
376
+ : T extends SubscribeRequest
377
+ ? SubscribeResponse
378
+ : T extends UnsubscribeRequest
379
+ ? UnsubscribeResponse
380
+ : T extends FeeRequest
381
+ ? FeeResponse
382
+ : T extends ManifestRequest
383
+ ? ManifestResponse
384
+ : T extends ServerInfoRequest
385
+ ? ServerInfoResponse
386
+ : T extends ServerStateRequest
387
+ ? ServerStateResponse
388
+ : T extends PingRequest
389
+ ? PingResponse
390
+ : T extends RandomRequest
391
+ ? RandomResponse
392
+ : T extends NFTBuyOffersRequest
393
+ ? NFTBuyOffersResponse
394
+ : T extends NFTSellOffersRequest
395
+ ? NFTSellOffersResponse
396
+ : T extends NFTInfoRequest
397
+ ? NFTInfoResponse
398
+ : T extends NFTHistoryRequest
399
+ ? NFTHistoryResponse
400
+ : Response
401
+
402
+ export type MarkerRequest = Request & {
403
+ limit?: number
404
+ marker?: unknown
405
+ }
406
+
407
+ export type MarkerResponse = Response & {
408
+ result: {
409
+ marker?: unknown
410
+ }
411
+ }
412
+
413
+ export type RequestAllResponseMap<T> = T extends AccountChannelsRequest
414
+ ? AccountChannelsResponse
415
+ : T extends AccountLinesRequest
416
+ ? AccountLinesResponse
417
+ : T extends AccountObjectsRequest
418
+ ? AccountObjectsResponse
419
+ : T extends AccountOffersRequest
420
+ ? AccountOffersResponse
421
+ : T extends AccountTxRequest
422
+ ? AccountTxResponse
423
+ : T extends LedgerDataRequest
424
+ ? LedgerDataResponse
425
+ : T extends AccountTxRequest
426
+ ? AccountTxResponse
427
+ : T extends BookOffersRequest
428
+ ? BookOffersResponse
429
+ : MarkerResponse
430
+
256
431
  export {
257
432
  // Allow users to define their own requests and responses. This is useful for releasing experimental versions
258
433
  BaseRequest,
@@ -72,6 +72,112 @@ export interface LedgerRequest extends BaseRequest, LookupByLedgerRequest {
72
72
  type?: LedgerEntryFilter
73
73
  }
74
74
 
75
+ /**
76
+ * Retrieve information about the public ledger. Expects a response in the form
77
+ * of a {@link LedgerResponseExpanded}. Will return full JSON-formatted transaction data instead of string hashes.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const ledger: LedgerRequest = {
82
+ * "id": 14,
83
+ * "command": "ledger",
84
+ * "ledger_index": "validated",
85
+ * "full": false,
86
+ * "accounts": false,
87
+ * "transactions": false,
88
+ * "expand": true,
89
+ * "owner_funds": false
90
+ * }
91
+ * ```
92
+ *
93
+ * @category Requests
94
+ */
95
+ export interface LedgerRequestExpandedTransactionsOnly extends LedgerRequest {
96
+ expand: true
97
+ transactions: true
98
+ }
99
+
100
+ /**
101
+ * Retrieve information about the public ledger. Expects a response in the form
102
+ * of a {@link LedgerResponseExpanded}. Will return full JSON-formatted `accountState` data instead of string hashes.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const ledger: LedgerRequest = {
107
+ * "id": 14,
108
+ * "command": "ledger",
109
+ * "ledger_index": "validated",
110
+ * "full": false,
111
+ * "accounts": true,
112
+ * "transactions": false,
113
+ * "expand": true,
114
+ * "owner_funds": false
115
+ * }
116
+ * ```
117
+ *
118
+ * @category Requests
119
+ */
120
+ export interface LedgerRequestExpandedAccountsOnly extends LedgerRequest {
121
+ expand: true
122
+ accounts: true
123
+ }
124
+
125
+ /**
126
+ * Retrieve information about the public ledger. Expects a response in the form
127
+ * of a {@link LedgerResponseExpanded}. Will return full JSON-formatted `accountState` and `transactions`
128
+ * data instead of string hashes.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const ledger: LedgerRequest = {
133
+ * "id": 14,
134
+ * "command": "ledger",
135
+ * "ledger_index": "validated",
136
+ * "full": false,
137
+ * "accounts": true,
138
+ * "transactions": true,
139
+ * "expand": true,
140
+ * "owner_funds": false
141
+ * }
142
+ * ```
143
+ *
144
+ * @category Requests
145
+ */
146
+ export interface LedgerRequestExpandedAccountsAndTransactions
147
+ extends LedgerRequest {
148
+ expand: true
149
+ accounts: true
150
+ transactions: true
151
+ }
152
+
153
+ /**
154
+ * Retrieve information about the public ledger. Expects a response in the form
155
+ * of a {@link LedgerResponse}. Will return binary (hexadecimal string) format
156
+ * instead of JSON or string hashes for `transactions` data.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const ledger: LedgerRequest = {
161
+ * "id": 14,
162
+ * "command": "ledger",
163
+ * "ledger_index": "validated",
164
+ * "full": false,
165
+ * "accounts": true,
166
+ * "transactions": true,
167
+ * "expand": true,
168
+ * "owner_funds": false,
169
+ * "binary": true
170
+ * }
171
+ * ```
172
+ *
173
+ * @category Requests
174
+ */
175
+ export interface LedgerRequestExpandedTransactionsBinary extends LedgerRequest {
176
+ expand: true
177
+ transactions: true
178
+ binary: true
179
+ }
180
+
75
181
  /**
76
182
  * Special case transaction definition when the request contains `owner_funds: true`.
77
183
  */
@@ -101,30 +207,53 @@ export interface LedgerBinary
101
207
  transactions?: string[]
102
208
  }
103
209
 
210
+ interface LedgerResponseBase {
211
+ /** Unique identifying hash of the entire ledger. */
212
+ ledger_hash: string
213
+ /** The Ledger Index of this ledger. */
214
+ ledger_index: number
215
+ /**
216
+ * If true, this is a validated ledger version. If omitted or set to false,
217
+ * this ledger's data is not final.
218
+ */
219
+ queue_data?: Array<LedgerQueueData | string>
220
+ /**
221
+ * Array of objects describing queued transactions, in the same order as
222
+ * the queue. If the request specified expand as true, members contain full
223
+ * representations of the transactions, in either JSON or binary depending
224
+ * on whether the request specified binary as true.
225
+ */
226
+ validated?: boolean
227
+ }
228
+
229
+ interface LedgerResponseResult extends LedgerResponseBase {
230
+ /** The complete header data of this {@link Ledger}. */
231
+ ledger: LedgerBinary
232
+ }
233
+
104
234
  /**
105
235
  * Response expected from a {@link LedgerRequest}.
236
+ * This is the default request response, triggered when `expand` and `binary` are both false.
106
237
  *
107
238
  * @category Responses
108
239
  */
109
240
  export interface LedgerResponse extends BaseResponse {
110
- result: {
111
- /** The complete header data of this {@link Ledger}. */
112
- ledger: Ledger | LedgerBinary
113
- /** Unique identifying hash of the entire ledger. */
114
- ledger_hash: string
115
- /** The Ledger Index of this ledger. */
116
- ledger_index: number
117
- /**
118
- * If true, this is a validated ledger version. If omitted or set to false,
119
- * this ledger's data is not final.
120
- */
121
- queue_data?: Array<LedgerQueueData | string>
122
- /**
123
- * Array of objects describing queued transactions, in the same order as
124
- * the queue. If the request specified expand as true, members contain full
125
- * representations of the transactions, in either JSON or binary depending
126
- * on whether the request specified binary as true.
127
- */
128
- validated?: boolean
129
- }
241
+ result: LedgerResponseResult
242
+ }
243
+
244
+ interface LedgerResponseExpandedResult extends LedgerResponseBase {
245
+ /** The complete header data of this {@link Ledger}. */
246
+ ledger: Ledger
247
+ }
248
+
249
+ /**
250
+ * Response expected from a {@link LedgerRequest} when the request contains `expanded` is true. See {@link LedgerRequestExpanded}.
251
+ * This response will contain full JSON-formatted data instead of string hashes.
252
+ * The response will contain either `accounts` or `transactions` or both.
253
+ * `binary` will be missing altogether.
254
+ *
255
+ * @category Responses
256
+ */
257
+ export interface LedgerResponseExpanded extends BaseResponse {
258
+ result: LedgerResponseExpandedResult
130
259
  }
@@ -10,6 +10,7 @@ import { OfferCreate, Transaction } from '../transactions'
10
10
  import { TransactionMetadata } from '../transactions/metadata'
11
11
 
12
12
  import type { BaseRequest, BaseResponse } from './baseMethod'
13
+ import { ManifestRequest } from './manifest'
13
14
 
14
15
  export interface SubscribeBook {
15
16
  /**
@@ -433,3 +434,38 @@ export type Stream =
433
434
  | PeerStatusStream
434
435
  | OrderBookStream
435
436
  | ConsensusStream
437
+
438
+ export type EventTypes =
439
+ | 'connected'
440
+ | 'disconnected'
441
+ | 'ledgerClosed'
442
+ | 'validationReceived'
443
+ | 'transaction'
444
+ | 'peerStatusChange'
445
+ | 'consensusPhase'
446
+ | 'manifestReceived'
447
+ | 'path_find'
448
+ | 'error'
449
+
450
+ export type OnEventToListenerMap<T extends EventTypes> = T extends 'connected'
451
+ ? () => void
452
+ : T extends 'disconnected'
453
+ ? (code: number) => void
454
+ : T extends 'ledgerClosed'
455
+ ? (ledger: LedgerStream) => void
456
+ : T extends 'validationReceived'
457
+ ? (validation: ValidationStream) => void
458
+ : T extends 'transaction'
459
+ ? (transaction: TransactionStream) => void
460
+ : T extends 'peerStatusChange'
461
+ ? (peerStatus: PeerStatusStream) => void
462
+ : T extends 'consensusPhase'
463
+ ? (consensus: ConsensusStream) => void
464
+ : T extends 'manifestReceived'
465
+ ? (manifest: ManifestRequest) => void
466
+ : T extends 'path_find'
467
+ ? (path: PathFindStream) => void
468
+ : T extends 'error'
469
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- needs to be any for overload
470
+ (...err: any[]) => void
471
+ : (...args: never[]) => void
@@ -12,6 +12,7 @@ import { BaseRequest, BaseResponse } from './baseMethod'
12
12
  */
13
13
  export interface TxRequest extends BaseRequest {
14
14
  command: 'tx'
15
+ /** The 256-bit hash of the transaction, as hex. */
15
16
  transaction: string
16
17
  /**
17
18
  * If true, return transaction data and metadata as binary serialized to
@@ -50,7 +51,7 @@ export interface TxResponse<
50
51
  ledger_index?: number
51
52
  /** Transaction metadata, which describes the results of the transaction.
52
53
  * Can be undefined if a transaction has not been validated yet. */
53
- meta?: TransactionMetadata | string
54
+ meta?: TransactionMetadata<T> | string
54
55
  /**
55
56
  * If true, this data comes from a validated ledger version; if omitted or.
56
57
  * Set to false, this data is not final.
@@ -6,6 +6,7 @@ import {
6
6
  parseAmountValue,
7
7
  validateBaseTransaction,
8
8
  } from './common'
9
+ import type { TransactionMetadataBase } from './metadata'
9
10
 
10
11
  /**
11
12
  * The NFTokenOfferAccept transaction is used to accept offers
@@ -64,6 +65,11 @@ export interface NFTokenAcceptOffer extends BaseTransaction {
64
65
  NFTokenBrokerFee?: Amount
65
66
  }
66
67
 
68
+ export interface NFTokenAcceptOfferMetadata extends TransactionMetadataBase {
69
+ // rippled 1.11.0 or later
70
+ nftoken_id?: string
71
+ }
72
+
67
73
  function validateNFTokenBrokerFee(tx: Record<string, unknown>): void {
68
74
  const value = parseAmountValue(tx.NFTokenBrokerFee)
69
75
  if (Number.isNaN(value)) {
@@ -1,6 +1,7 @@
1
1
  import { ValidationError } from '../../errors'
2
2
 
3
3
  import { BaseTransaction, validateBaseTransaction } from './common'
4
+ import type { TransactionMetadataBase } from './metadata'
4
5
 
5
6
  /**
6
7
  * The NFTokenCancelOffer transaction deletes existing NFTokenOffer objects.
@@ -26,6 +27,11 @@ export interface NFTokenCancelOffer extends BaseTransaction {
26
27
  NFTokenOffers: string[]
27
28
  }
28
29
 
30
+ export interface NFTokenCancelOfferMetadata extends TransactionMetadataBase {
31
+ // rippled 1.11.0 or later
32
+ nftoken_ids?: string[]
33
+ }
34
+
29
35
  /**
30
36
  * Verify the form and type of an NFTokenCancelOffer at runtime.
31
37
  *
@@ -12,6 +12,7 @@ import {
12
12
  validateOptionalField,
13
13
  Account,
14
14
  } from './common'
15
+ import type { TransactionMetadataBase } from './metadata'
15
16
 
16
17
  /**
17
18
  * Transaction Flags for an NFTokenCreateOffer Transaction.
@@ -86,6 +87,11 @@ export interface NFTokenCreateOffer extends BaseTransaction {
86
87
  Flags?: number | NFTokenCreateOfferFlagsInterface
87
88
  }
88
89
 
90
+ export interface NFTokenCreateOfferMetadata extends TransactionMetadataBase {
91
+ // rippled 1.11.0 or later
92
+ offer_id?: string
93
+ }
94
+
89
95
  function validateNFTokenSellOfferCases(tx: Record<string, unknown>): void {
90
96
  if (tx.Owner != null) {
91
97
  throw new ValidationError(
@@ -9,6 +9,7 @@ import {
9
9
  validateBaseTransaction,
10
10
  validateOptionalField,
11
11
  } from './common'
12
+ import type { TransactionMetadataBase } from './metadata'
12
13
 
13
14
  /**
14
15
  * Transaction Flags for an NFTokenMint Transaction.
@@ -101,6 +102,11 @@ export interface NFTokenMint extends BaseTransaction {
101
102
  Flags?: number | NFTokenMintFlagsInterface
102
103
  }
103
104
 
105
+ export interface NFTokenMintMetadata extends TransactionMetadataBase {
106
+ // rippled 1.11.0 or later
107
+ nftoken_id?: string
108
+ }
109
+
104
110
  /**
105
111
  * Verify the form and type of an NFTokenMint at runtime.
106
112
  *
@@ -1,5 +1,22 @@
1
1
  import { Amount } from '../common'
2
2
 
3
+ import { BaseTransaction } from './common'
4
+ import {
5
+ NFTokenAcceptOffer,
6
+ NFTokenAcceptOfferMetadata,
7
+ } from './NFTokenAcceptOffer'
8
+ import {
9
+ NFTokenCancelOffer,
10
+ NFTokenCancelOfferMetadata,
11
+ } from './NFTokenCancelOffer'
12
+ import {
13
+ NFTokenCreateOffer,
14
+ NFTokenCreateOfferMetadata,
15
+ } from './NFTokenCreateOffer'
16
+ import { NFTokenMint, NFTokenMintMetadata } from './NFTokenMint'
17
+ import { Payment, PaymentMetadata } from './payment'
18
+ import type { Transaction } from './transaction'
19
+
3
20
  export interface CreatedNode {
4
21
  CreatedNode: {
5
22
  LedgerEntryType: string
@@ -59,7 +76,7 @@ export function isDeletedNode(node: Node): node is DeletedNode {
59
76
  return Object.prototype.hasOwnProperty.call(node, `DeletedNode`)
60
77
  }
61
78
 
62
- export interface TransactionMetadata {
79
+ export interface TransactionMetadataBase {
63
80
  AffectedNodes: Node[]
64
81
  DeliveredAmount?: Amount
65
82
  // "unavailable" possible for transactions before 2014-01-20
@@ -67,3 +84,16 @@ export interface TransactionMetadata {
67
84
  TransactionIndex: number
68
85
  TransactionResult: string
69
86
  }
87
+
88
+ export type TransactionMetadata<T extends BaseTransaction = Transaction> =
89
+ T extends Payment
90
+ ? PaymentMetadata
91
+ : T extends NFTokenMint
92
+ ? NFTokenMintMetadata
93
+ : T extends NFTokenCreateOffer
94
+ ? NFTokenCreateOfferMetadata
95
+ : T extends NFTokenAcceptOffer
96
+ ? NFTokenAcceptOfferMetadata
97
+ : T extends NFTokenCancelOffer
98
+ ? NFTokenCancelOfferMetadata
99
+ : TransactionMetadataBase
@@ -13,6 +13,7 @@ import {
13
13
  isNumber,
14
14
  Account,
15
15
  } from './common'
16
+ import type { TransactionMetadataBase } from './metadata'
16
17
 
17
18
  /**
18
19
  * Enum representing values for Payment Transaction Flags.
@@ -151,6 +152,11 @@ export interface Payment extends BaseTransaction {
151
152
  Flags?: number | PaymentFlagsInterface
152
153
  }
153
154
 
155
+ export interface PaymentMetadata extends TransactionMetadataBase {
156
+ DeliveredAmount?: Amount
157
+ delivered_amount?: Amount | 'unavailable'
158
+ }
159
+
154
160
  /**
155
161
  * Verify the form and type of a Payment at runtime.
156
162
  *