xrpl 2.14.0 → 3.0.0-beta.1

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 (407) 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 +15451 -74357
  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/rfc1751.d.ts +1 -2
  20. package/dist/npm/Wallet/rfc1751.d.ts.map +1 -1
  21. package/dist/npm/Wallet/rfc1751.js +21 -5
  22. package/dist/npm/Wallet/rfc1751.js.map +1 -1
  23. package/dist/npm/Wallet/signer.d.ts +2 -4
  24. package/dist/npm/Wallet/signer.d.ts.map +1 -1
  25. package/dist/npm/Wallet/signer.js +19 -14
  26. package/dist/npm/Wallet/signer.js.map +1 -1
  27. package/dist/npm/Wallet/walletFromSecretNumbers.js +2 -2
  28. package/dist/npm/Wallet/walletFromSecretNumbers.js.map +1 -1
  29. package/dist/npm/client/RequestManager.d.ts +3 -2
  30. package/dist/npm/client/RequestManager.d.ts.map +1 -1
  31. package/dist/npm/client/RequestManager.js +25 -1
  32. package/dist/npm/client/RequestManager.js.map +1 -1
  33. package/dist/npm/client/connection.d.ts +8 -11
  34. package/dist/npm/client/connection.d.ts.map +1 -1
  35. package/dist/npm/client/connection.js +11 -57
  36. package/dist/npm/client/connection.js.map +1 -1
  37. package/dist/npm/client/index.d.ts +56 -79
  38. package/dist/npm/client/index.d.ts.map +1 -1
  39. package/dist/npm/client/index.js +155 -42
  40. package/dist/npm/client/index.js.map +1 -1
  41. package/dist/npm/client/partialPayment.d.ts +4 -2
  42. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  43. package/dist/npm/client/partialPayment.js.map +1 -1
  44. package/dist/npm/errors.d.ts.map +1 -1
  45. package/dist/npm/errors.js +1 -2
  46. package/dist/npm/errors.js.map +1 -1
  47. package/dist/npm/index.d.ts +1 -1
  48. package/dist/npm/index.d.ts.map +1 -1
  49. package/dist/npm/index.js +1 -3
  50. package/dist/npm/index.js.map +1 -1
  51. package/dist/npm/models/ledger/AccountRoot.js +1 -1
  52. package/dist/npm/models/ledger/AccountRoot.js.map +1 -1
  53. package/dist/npm/models/ledger/Ledger.d.ts +2 -2
  54. package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
  55. package/dist/npm/models/ledger/Offer.js +1 -1
  56. package/dist/npm/models/ledger/Offer.js.map +1 -1
  57. package/dist/npm/models/ledger/RippleState.js +1 -1
  58. package/dist/npm/models/ledger/RippleState.js.map +1 -1
  59. package/dist/npm/models/ledger/SignerList.js +1 -1
  60. package/dist/npm/models/ledger/SignerList.js.map +1 -1
  61. package/dist/npm/models/methods/index.d.ts +12 -1
  62. package/dist/npm/models/methods/index.d.ts.map +1 -1
  63. package/dist/npm/models/methods/ledger.d.ts +35 -7
  64. package/dist/npm/models/methods/ledger.d.ts.map +1 -1
  65. package/dist/npm/models/methods/submit.d.ts +2 -2
  66. package/dist/npm/models/methods/submit.d.ts.map +1 -1
  67. package/dist/npm/models/methods/subscribe.d.ts +3 -0
  68. package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
  69. package/dist/npm/models/methods/tx.d.ts +2 -3
  70. package/dist/npm/models/methods/tx.d.ts.map +1 -1
  71. package/dist/npm/models/transactions/AMMDeposit.js +1 -1
  72. package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
  73. package/dist/npm/models/transactions/AMMWithdraw.js +1 -1
  74. package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
  75. package/dist/npm/models/transactions/NFTokenAcceptOffer.d.ts +4 -0
  76. package/dist/npm/models/transactions/NFTokenAcceptOffer.d.ts.map +1 -1
  77. package/dist/npm/models/transactions/NFTokenAcceptOffer.js.map +1 -1
  78. package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts +4 -0
  79. package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  80. package/dist/npm/models/transactions/NFTokenCancelOffer.js.map +1 -1
  81. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts +4 -0
  82. package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  83. package/dist/npm/models/transactions/NFTokenCreateOffer.js +1 -1
  84. package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
  85. package/dist/npm/models/transactions/NFTokenMint.d.ts +4 -0
  86. package/dist/npm/models/transactions/NFTokenMint.d.ts.map +1 -1
  87. package/dist/npm/models/transactions/NFTokenMint.js +1 -1
  88. package/dist/npm/models/transactions/NFTokenMint.js.map +1 -1
  89. package/dist/npm/models/transactions/XChainModifyBridge.js +1 -1
  90. package/dist/npm/models/transactions/XChainModifyBridge.js.map +1 -1
  91. package/dist/npm/models/transactions/accountSet.js +2 -2
  92. package/dist/npm/models/transactions/accountSet.js.map +1 -1
  93. package/dist/npm/models/transactions/enableAmendment.js +1 -1
  94. package/dist/npm/models/transactions/enableAmendment.js.map +1 -1
  95. package/dist/npm/models/transactions/index.d.ts +1 -1
  96. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  97. package/dist/npm/models/transactions/index.js.map +1 -1
  98. package/dist/npm/models/transactions/metadata.d.ts +9 -1
  99. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  100. package/dist/npm/models/transactions/metadata.js.map +1 -1
  101. package/dist/npm/models/transactions/offerCreate.js +1 -1
  102. package/dist/npm/models/transactions/offerCreate.js.map +1 -1
  103. package/dist/npm/models/transactions/payment.d.ts +5 -0
  104. package/dist/npm/models/transactions/payment.d.ts.map +1 -1
  105. package/dist/npm/models/transactions/payment.js +1 -1
  106. package/dist/npm/models/transactions/payment.js.map +1 -1
  107. package/dist/npm/models/transactions/paymentChannelClaim.js +1 -1
  108. package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
  109. package/dist/npm/models/transactions/transaction.d.ts +6 -4
  110. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  111. package/dist/npm/models/transactions/transaction.js.map +1 -1
  112. package/dist/npm/models/transactions/trustSet.js +1 -1
  113. package/dist/npm/models/transactions/trustSet.js.map +1 -1
  114. package/dist/npm/snippets/src/bridgeTransfer.js +2 -2
  115. package/dist/npm/snippets/src/bridgeTransfer.js.map +1 -1
  116. package/dist/npm/snippets/src/getTransaction.js +1 -1
  117. package/dist/npm/snippets/src/getTransaction.js.map +1 -1
  118. package/dist/npm/snippets/src/paths.js +2 -3
  119. package/dist/npm/snippets/src/paths.js.map +1 -1
  120. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  121. package/dist/npm/src/Wallet/authorizeChannel.d.ts +3 -0
  122. package/dist/npm/src/Wallet/authorizeChannel.d.ts.map +1 -0
  123. package/dist/npm/src/Wallet/authorizeChannel.js +14 -0
  124. package/dist/npm/src/Wallet/authorizeChannel.js.map +1 -0
  125. package/dist/npm/src/Wallet/defaultFaucets.js +1 -1
  126. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  127. package/dist/npm/src/Wallet/fundWallet.d.ts +17 -3
  128. package/dist/npm/src/Wallet/fundWallet.d.ts.map +1 -1
  129. package/dist/npm/src/Wallet/fundWallet.js +53 -78
  130. package/dist/npm/src/Wallet/fundWallet.js.map +1 -1
  131. package/dist/npm/src/Wallet/index.d.ts.map +1 -1
  132. package/dist/npm/src/Wallet/index.js +24 -23
  133. package/dist/npm/src/Wallet/index.js.map +1 -1
  134. package/dist/npm/src/Wallet/rfc1751.d.ts +1 -2
  135. package/dist/npm/src/Wallet/rfc1751.d.ts.map +1 -1
  136. package/dist/npm/src/Wallet/rfc1751.js +21 -5
  137. package/dist/npm/src/Wallet/rfc1751.js.map +1 -1
  138. package/dist/npm/src/Wallet/signer.d.ts +2 -4
  139. package/dist/npm/src/Wallet/signer.d.ts.map +1 -1
  140. package/dist/npm/src/Wallet/signer.js +19 -14
  141. package/dist/npm/src/Wallet/signer.js.map +1 -1
  142. package/dist/npm/src/Wallet/walletFromSecretNumbers.js +2 -2
  143. package/dist/npm/src/Wallet/walletFromSecretNumbers.js.map +1 -1
  144. package/dist/npm/src/client/RequestManager.d.ts +3 -2
  145. package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
  146. package/dist/npm/src/client/RequestManager.js +25 -1
  147. package/dist/npm/src/client/RequestManager.js.map +1 -1
  148. package/dist/npm/src/client/connection.d.ts +8 -11
  149. package/dist/npm/src/client/connection.d.ts.map +1 -1
  150. package/dist/npm/src/client/connection.js +11 -57
  151. package/dist/npm/src/client/connection.js.map +1 -1
  152. package/dist/npm/src/client/index.d.ts +56 -79
  153. package/dist/npm/src/client/index.d.ts.map +1 -1
  154. package/dist/npm/src/client/index.js +155 -42
  155. package/dist/npm/src/client/index.js.map +1 -1
  156. package/dist/npm/src/client/partialPayment.d.ts +4 -2
  157. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  158. package/dist/npm/src/client/partialPayment.js.map +1 -1
  159. package/dist/npm/src/errors.d.ts.map +1 -1
  160. package/dist/npm/src/errors.js +1 -2
  161. package/dist/npm/src/errors.js.map +1 -1
  162. package/dist/npm/src/index.d.ts +1 -1
  163. package/dist/npm/src/index.d.ts.map +1 -1
  164. package/dist/npm/src/index.js +1 -3
  165. package/dist/npm/src/index.js.map +1 -1
  166. package/dist/npm/src/models/ledger/AccountRoot.js +1 -1
  167. package/dist/npm/src/models/ledger/AccountRoot.js.map +1 -1
  168. package/dist/npm/src/models/ledger/Ledger.d.ts +2 -2
  169. package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
  170. package/dist/npm/src/models/ledger/Offer.js +1 -1
  171. package/dist/npm/src/models/ledger/Offer.js.map +1 -1
  172. package/dist/npm/src/models/ledger/RippleState.js +1 -1
  173. package/dist/npm/src/models/ledger/RippleState.js.map +1 -1
  174. package/dist/npm/src/models/ledger/SignerList.js +1 -1
  175. package/dist/npm/src/models/ledger/SignerList.js.map +1 -1
  176. package/dist/npm/src/models/methods/index.d.ts +12 -1
  177. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  178. package/dist/npm/src/models/methods/ledger.d.ts +35 -7
  179. package/dist/npm/src/models/methods/ledger.d.ts.map +1 -1
  180. package/dist/npm/src/models/methods/submit.d.ts +2 -2
  181. package/dist/npm/src/models/methods/submit.d.ts.map +1 -1
  182. package/dist/npm/src/models/methods/subscribe.d.ts +3 -0
  183. package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
  184. package/dist/npm/src/models/methods/tx.d.ts +2 -3
  185. package/dist/npm/src/models/methods/tx.d.ts.map +1 -1
  186. package/dist/npm/src/models/transactions/AMMDeposit.js +1 -1
  187. package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
  188. package/dist/npm/src/models/transactions/AMMWithdraw.js +1 -1
  189. package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
  190. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.d.ts +4 -0
  191. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.d.ts.map +1 -1
  192. package/dist/npm/src/models/transactions/NFTokenAcceptOffer.js.map +1 -1
  193. package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts +4 -0
  194. package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
  195. package/dist/npm/src/models/transactions/NFTokenCancelOffer.js.map +1 -1
  196. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts +4 -0
  197. package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
  198. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js +1 -1
  199. package/dist/npm/src/models/transactions/NFTokenCreateOffer.js.map +1 -1
  200. package/dist/npm/src/models/transactions/NFTokenMint.d.ts +4 -0
  201. package/dist/npm/src/models/transactions/NFTokenMint.d.ts.map +1 -1
  202. package/dist/npm/src/models/transactions/NFTokenMint.js +1 -1
  203. package/dist/npm/src/models/transactions/NFTokenMint.js.map +1 -1
  204. package/dist/npm/src/models/transactions/XChainModifyBridge.js +1 -1
  205. package/dist/npm/src/models/transactions/XChainModifyBridge.js.map +1 -1
  206. package/dist/npm/src/models/transactions/accountSet.js +2 -2
  207. package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
  208. package/dist/npm/src/models/transactions/enableAmendment.js +1 -1
  209. package/dist/npm/src/models/transactions/enableAmendment.js.map +1 -1
  210. package/dist/npm/src/models/transactions/index.d.ts +1 -1
  211. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  212. package/dist/npm/src/models/transactions/index.js.map +1 -1
  213. package/dist/npm/src/models/transactions/metadata.d.ts +9 -1
  214. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  215. package/dist/npm/src/models/transactions/metadata.js.map +1 -1
  216. package/dist/npm/src/models/transactions/offerCreate.js +1 -1
  217. package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
  218. package/dist/npm/src/models/transactions/payment.d.ts +5 -0
  219. package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
  220. package/dist/npm/src/models/transactions/payment.js +1 -1
  221. package/dist/npm/src/models/transactions/payment.js.map +1 -1
  222. package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -1
  223. package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
  224. package/dist/npm/src/models/transactions/transaction.d.ts +6 -4
  225. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  226. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  227. package/dist/npm/src/models/transactions/trustSet.js +1 -1
  228. package/dist/npm/src/models/transactions/trustSet.js.map +1 -1
  229. package/dist/npm/src/sugar/autofill.d.ts +6 -2
  230. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  231. package/dist/npm/src/sugar/autofill.js +9 -28
  232. package/dist/npm/src/sugar/autofill.js.map +1 -1
  233. package/dist/npm/src/sugar/balances.d.ts +2 -17
  234. package/dist/npm/src/sugar/balances.d.ts.map +1 -1
  235. package/dist/npm/src/sugar/balances.js +2 -60
  236. package/dist/npm/src/sugar/balances.js.map +1 -1
  237. package/dist/npm/src/sugar/getOrderbook.d.ts +19 -5
  238. package/dist/npm/src/sugar/getOrderbook.d.ts.map +1 -1
  239. package/dist/npm/src/sugar/getOrderbook.js +72 -53
  240. package/dist/npm/src/sugar/getOrderbook.js.map +1 -1
  241. package/dist/npm/src/sugar/index.d.ts +0 -4
  242. package/dist/npm/src/sugar/index.d.ts.map +1 -1
  243. package/dist/npm/src/sugar/index.js +0 -13
  244. package/dist/npm/src/sugar/index.js.map +1 -1
  245. package/dist/npm/src/sugar/submit.d.ts +7 -11
  246. package/dist/npm/src/sugar/submit.d.ts.map +1 -1
  247. package/dist/npm/src/sugar/submit.js +5 -22
  248. package/dist/npm/src/sugar/submit.js.map +1 -1
  249. package/dist/npm/src/utils/collections.d.ts +5 -0
  250. package/dist/npm/src/utils/collections.d.ts.map +1 -0
  251. package/dist/npm/src/utils/collections.js +24 -0
  252. package/dist/npm/src/utils/collections.js.map +1 -0
  253. package/dist/npm/src/utils/getBalanceChanges.d.ts.map +1 -1
  254. package/dist/npm/src/utils/getBalanceChanges.js +3 -4
  255. package/dist/npm/src/utils/getBalanceChanges.js.map +1 -1
  256. package/dist/npm/src/utils/getNFTokenID.d.ts.map +1 -1
  257. package/dist/npm/src/utils/getNFTokenID.js +8 -8
  258. package/dist/npm/src/utils/getNFTokenID.js.map +1 -1
  259. package/dist/npm/src/utils/hashes/SHAMap/node.js +1 -1
  260. package/dist/npm/src/utils/hashes/SHAMap/node.js.map +1 -1
  261. package/dist/npm/src/utils/hashes/hashLedger.d.ts +1 -2
  262. package/dist/npm/src/utils/hashes/hashLedger.d.ts.map +1 -1
  263. package/dist/npm/src/utils/hashes/hashLedger.js +7 -7
  264. package/dist/npm/src/utils/hashes/hashLedger.js.map +1 -1
  265. package/dist/npm/src/utils/hashes/index.d.ts.map +1 -1
  266. package/dist/npm/src/utils/hashes/index.js +3 -2
  267. package/dist/npm/src/utils/hashes/index.js.map +1 -1
  268. package/dist/npm/src/utils/hashes/sha512Half.d.ts.map +1 -1
  269. package/dist/npm/src/utils/hashes/sha512Half.js +4 -7
  270. package/dist/npm/src/utils/hashes/sha512Half.js.map +1 -1
  271. package/dist/npm/src/utils/index.d.ts.map +1 -1
  272. package/dist/npm/src/utils/index.js +6 -29
  273. package/dist/npm/src/utils/index.js.map +1 -1
  274. package/dist/npm/src/utils/parseNFTokenID.d.ts.map +1 -1
  275. package/dist/npm/src/utils/parseNFTokenID.js +2 -1
  276. package/dist/npm/src/utils/parseNFTokenID.js.map +1 -1
  277. package/dist/npm/src/utils/stringConversion.d.ts +1 -2
  278. package/dist/npm/src/utils/stringConversion.d.ts.map +1 -1
  279. package/dist/npm/src/utils/stringConversion.js +3 -2
  280. package/dist/npm/src/utils/stringConversion.js.map +1 -1
  281. package/dist/npm/src/utils/xrpConversion.d.ts +1 -1
  282. package/dist/npm/src/utils/xrpConversion.js +1 -1
  283. package/dist/npm/src/utils/xrpConversion.js.map +1 -1
  284. package/dist/npm/sugar/autofill.d.ts +6 -2
  285. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  286. package/dist/npm/sugar/autofill.js +9 -28
  287. package/dist/npm/sugar/autofill.js.map +1 -1
  288. package/dist/npm/sugar/balances.d.ts +2 -17
  289. package/dist/npm/sugar/balances.d.ts.map +1 -1
  290. package/dist/npm/sugar/balances.js +2 -60
  291. package/dist/npm/sugar/balances.js.map +1 -1
  292. package/dist/npm/sugar/getOrderbook.d.ts +19 -5
  293. package/dist/npm/sugar/getOrderbook.d.ts.map +1 -1
  294. package/dist/npm/sugar/getOrderbook.js +72 -53
  295. package/dist/npm/sugar/getOrderbook.js.map +1 -1
  296. package/dist/npm/sugar/index.d.ts +0 -4
  297. package/dist/npm/sugar/index.d.ts.map +1 -1
  298. package/dist/npm/sugar/index.js +0 -13
  299. package/dist/npm/sugar/index.js.map +1 -1
  300. package/dist/npm/sugar/submit.d.ts +7 -11
  301. package/dist/npm/sugar/submit.d.ts.map +1 -1
  302. package/dist/npm/sugar/submit.js +5 -22
  303. package/dist/npm/sugar/submit.js.map +1 -1
  304. package/dist/npm/utils/collections.d.ts +5 -0
  305. package/dist/npm/utils/collections.d.ts.map +1 -0
  306. package/dist/npm/utils/collections.js +24 -0
  307. package/dist/npm/utils/collections.js.map +1 -0
  308. package/dist/npm/utils/getBalanceChanges.d.ts.map +1 -1
  309. package/dist/npm/utils/getBalanceChanges.js +3 -4
  310. package/dist/npm/utils/getBalanceChanges.js.map +1 -1
  311. package/dist/npm/utils/getNFTokenID.d.ts.map +1 -1
  312. package/dist/npm/utils/getNFTokenID.js +8 -8
  313. package/dist/npm/utils/getNFTokenID.js.map +1 -1
  314. package/dist/npm/utils/hashes/SHAMap/node.js +1 -1
  315. package/dist/npm/utils/hashes/SHAMap/node.js.map +1 -1
  316. package/dist/npm/utils/hashes/hashLedger.d.ts +1 -2
  317. package/dist/npm/utils/hashes/hashLedger.d.ts.map +1 -1
  318. package/dist/npm/utils/hashes/hashLedger.js +7 -7
  319. package/dist/npm/utils/hashes/hashLedger.js.map +1 -1
  320. package/dist/npm/utils/hashes/index.d.ts.map +1 -1
  321. package/dist/npm/utils/hashes/index.js +3 -2
  322. package/dist/npm/utils/hashes/index.js.map +1 -1
  323. package/dist/npm/utils/hashes/sha512Half.d.ts.map +1 -1
  324. package/dist/npm/utils/hashes/sha512Half.js +4 -7
  325. package/dist/npm/utils/hashes/sha512Half.js.map +1 -1
  326. package/dist/npm/utils/index.d.ts.map +1 -1
  327. package/dist/npm/utils/index.js +6 -29
  328. package/dist/npm/utils/index.js.map +1 -1
  329. package/dist/npm/utils/parseNFTokenID.d.ts.map +1 -1
  330. package/dist/npm/utils/parseNFTokenID.js +2 -1
  331. package/dist/npm/utils/parseNFTokenID.js.map +1 -1
  332. package/dist/npm/utils/stringConversion.d.ts +1 -2
  333. package/dist/npm/utils/stringConversion.d.ts.map +1 -1
  334. package/dist/npm/utils/stringConversion.js +3 -2
  335. package/dist/npm/utils/stringConversion.js.map +1 -1
  336. package/dist/npm/utils/xrpConversion.d.ts +1 -1
  337. package/dist/npm/utils/xrpConversion.js +1 -1
  338. package/dist/npm/utils/xrpConversion.js.map +1 -1
  339. package/package.json +23 -25
  340. package/src/Wallet/authorizeChannel.ts +26 -0
  341. package/src/Wallet/fundWallet.ts +153 -214
  342. package/src/Wallet/index.ts +28 -25
  343. package/src/Wallet/rfc1751.ts +45 -16
  344. package/src/Wallet/signer.ts +34 -44
  345. package/src/Wallet/walletFromSecretNumbers.ts +1 -1
  346. package/src/client/RequestManager.ts +40 -14
  347. package/src/client/connection.ts +26 -93
  348. package/src/client/index.ts +706 -274
  349. package/src/client/partialPayment.ts +16 -14
  350. package/src/errors.ts +1 -3
  351. package/src/index.ts +1 -3
  352. package/src/models/ledger/Ledger.ts +3 -9
  353. package/src/models/methods/index.ts +177 -0
  354. package/src/models/methods/ledger.ts +149 -20
  355. package/src/models/methods/submit.ts +2 -2
  356. package/src/models/methods/subscribe.ts +36 -0
  357. package/src/models/methods/tx.ts +3 -5
  358. package/src/models/transactions/NFTokenAcceptOffer.ts +6 -0
  359. package/src/models/transactions/NFTokenCancelOffer.ts +6 -0
  360. package/src/models/transactions/NFTokenCreateOffer.ts +6 -0
  361. package/src/models/transactions/NFTokenMint.ts +6 -0
  362. package/src/models/transactions/index.ts +1 -0
  363. package/src/models/transactions/metadata.ts +31 -1
  364. package/src/models/transactions/payment.ts +6 -0
  365. package/src/models/transactions/transaction.ts +21 -5
  366. package/src/sugar/autofill.ts +84 -88
  367. package/src/sugar/balances.ts +8 -116
  368. package/src/sugar/getOrderbook.ts +138 -61
  369. package/src/sugar/index.ts +0 -8
  370. package/src/sugar/submit.ts +128 -140
  371. package/src/utils/collections.ts +57 -0
  372. package/src/utils/getBalanceChanges.ts +2 -3
  373. package/src/utils/getNFTokenID.ts +18 -16
  374. package/src/utils/hashes/hashLedger.ts +7 -9
  375. package/src/utils/hashes/index.ts +3 -2
  376. package/src/utils/hashes/sha512Half.ts +4 -7
  377. package/src/utils/index.ts +12 -6
  378. package/src/utils/parseNFTokenID.ts +2 -1
  379. package/src/utils/stringConversion.ts +11 -6
  380. package/src/utils/xrpConversion.ts +2 -2
  381. package/dist/npm/client/BroadcastClient.d.ts +0 -7
  382. package/dist/npm/client/BroadcastClient.d.ts.map +0 -1
  383. package/dist/npm/client/BroadcastClient.js +0 -49
  384. package/dist/npm/client/BroadcastClient.js.map +0 -1
  385. package/dist/npm/client/WSWrapper.d.ts +0 -25
  386. package/dist/npm/client/WSWrapper.d.ts.map +0 -1
  387. package/dist/npm/client/WSWrapper.js +0 -44
  388. package/dist/npm/client/WSWrapper.js.map +0 -1
  389. package/dist/npm/src/client/BroadcastClient.d.ts +0 -7
  390. package/dist/npm/src/client/BroadcastClient.d.ts.map +0 -1
  391. package/dist/npm/src/client/BroadcastClient.js +0 -49
  392. package/dist/npm/src/client/BroadcastClient.js.map +0 -1
  393. package/dist/npm/src/client/WSWrapper.d.ts +0 -25
  394. package/dist/npm/src/client/WSWrapper.d.ts.map +0 -1
  395. package/dist/npm/src/client/WSWrapper.js +0 -44
  396. package/dist/npm/src/client/WSWrapper.js.map +0 -1
  397. package/dist/npm/src/sugar/getLedgerIndex.d.ts +0 -3
  398. package/dist/npm/src/sugar/getLedgerIndex.d.ts.map +0 -1
  399. package/dist/npm/src/sugar/getLedgerIndex.js +0 -22
  400. package/dist/npm/src/sugar/getLedgerIndex.js.map +0 -1
  401. package/dist/npm/sugar/getLedgerIndex.d.ts +0 -3
  402. package/dist/npm/sugar/getLedgerIndex.d.ts.map +0 -1
  403. package/dist/npm/sugar/getLedgerIndex.js +0 -22
  404. package/dist/npm/sugar/getLedgerIndex.js.map +0 -1
  405. package/src/client/BroadcastClient.ts +0 -84
  406. package/src/client/WSWrapper.ts +0 -106
  407. package/src/sugar/getLedgerIndex.ts +0 -15
@@ -3,18 +3,14 @@ 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'
13
- import {
14
- PaymentFlags,
15
- PseudoTransaction,
16
- Transaction,
17
- } from '../models/transactions'
11
+ import type { RequestResponseMap } from '../models/methods'
12
+ import { BaseRequest, BaseResponse } from '../models/methods/baseMethod'
13
+ import { PaymentFlags, Transaction } from '../models/transactions'
18
14
  import type { TransactionMetadata } from '../models/transactions/metadata'
19
15
  import { isFlagEnabled } from '../models/utils'
20
16
 
@@ -40,7 +36,7 @@ function amountsEqual(amt1: Amount, amt2: Amount): boolean {
40
36
  }
41
37
 
42
38
  function isPartialPayment(
43
- tx?: Transaction | PseudoTransaction,
39
+ tx?: Transaction,
44
40
  metadata?: TransactionMetadata | string,
45
41
  ): boolean {
46
42
  if (tx == null || metadata == null || tx.TransactionType !== 'Payment') {
@@ -90,7 +86,10 @@ function accountTxHasPartialPayment(response: AccountTxResponse): boolean {
90
86
  return foo
91
87
  }
92
88
 
93
- function hasPartialPayment(command: string, response: Response): boolean {
89
+ function hasPartialPayment<R extends BaseRequest, T = RequestResponseMap<R>>(
90
+ command: string,
91
+ response: T,
92
+ ): boolean {
94
93
  /* eslint-disable @typescript-eslint/consistent-type-assertions -- Request type is known at runtime from command */
95
94
  switch (command) {
96
95
  case 'tx':
@@ -111,12 +110,13 @@ function hasPartialPayment(command: string, response: Response): boolean {
111
110
  * @param command - Command from the request, tells us what response to expect.
112
111
  * @param response - Response to check for a partial payment.
113
112
  */
114
- export function handlePartialPayment(
115
- command: string,
116
- response: Response,
117
- ): void {
113
+ export function handlePartialPayment<
114
+ R extends BaseRequest,
115
+ T = RequestResponseMap<R>,
116
+ >(command: string, response: T): void {
118
117
  if (hasPartialPayment(command, response)) {
119
- const warnings: ResponseWarning[] = response.warnings ?? []
118
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We are checking dynamically and safely.
119
+ const warnings = (response as BaseResponse).warnings ?? []
120
120
 
121
121
  const warning = {
122
122
  id: WARN_PARTIAL_PAYMENT_CODE,
@@ -125,6 +125,8 @@ export function handlePartialPayment(
125
125
 
126
126
  warnings.push(warning)
127
127
 
128
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- We are checking dynamically and safely.
129
+ // @ts-expect-error -- We are checking dynamically and safely.
128
130
  response.warnings = warnings
129
131
  }
130
132
  }
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'
@@ -1,8 +1,4 @@
1
- import {
2
- PseudoTransaction,
3
- Transaction,
4
- TransactionMetadata,
5
- } from '../transactions'
1
+ import { Transaction, TransactionMetadata } from '../transactions'
6
2
 
7
3
  import { LedgerEntry } from './LedgerEntry'
8
4
 
@@ -15,7 +11,7 @@ import { LedgerEntry } from './LedgerEntry'
15
11
  export default interface Ledger {
16
12
  /** The SHA-512Half of this ledger's state tree information. */
17
13
  account_hash: string
18
- /** All the state information in this ledger. */
14
+ /** All the state information in this ledger. Admin only. */
19
15
  accountState?: LedgerEntry[]
20
16
  /** A bit-map of flags relating to the closing of this ledger. */
21
17
  close_flags: number
@@ -65,7 +61,5 @@ export default interface Ledger {
65
61
  * either JSON or binary depending on whether the request specified binary
66
62
  * as true.
67
63
  */
68
- transactions?: Array<
69
- (Transaction | PseudoTransaction) & { metaData?: TransactionMetadata }
70
- >
64
+ transactions?: Array<Transaction & { metaData?: TransactionMetadata }>
71
65
  }
@@ -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'
@@ -259,6 +265,177 @@ type Response =
259
265
  // AMM methods
260
266
  | AMMInfoResponse
261
267
 
268
+ export type RequestResponseMap<T> = T extends AccountChannelsRequest
269
+ ? AccountChannelsResponse
270
+ : T extends AccountCurrenciesRequest
271
+ ? AccountCurrenciesResponse
272
+ : T extends AccountInfoRequest
273
+ ? AccountInfoResponse
274
+ : T extends AccountLinesRequest
275
+ ? AccountLinesResponse
276
+ : T extends AccountNFTsRequest
277
+ ? AccountNFTsResponse
278
+ : T extends AccountObjectsRequest
279
+ ? AccountObjectsResponse
280
+ : T extends AccountOffersRequest
281
+ ? AccountOffersResponse
282
+ : T extends AccountTxRequest
283
+ ? AccountTxResponse
284
+ : T extends AMMInfoRequest
285
+ ? AMMInfoResponse
286
+ : T extends GatewayBalancesRequest
287
+ ? GatewayBalancesResponse
288
+ : T extends NoRippleCheckRequest
289
+ ? NoRippleCheckResponse
290
+ : // NOTE: The order of these LedgerRequest types is important
291
+ // to get the proper type matching overrides based on parameters set
292
+ // in the request. For example LedgerRequestExpandedTransactionsBinary
293
+ // should match LedgerRequestExpandedTransactionsOnly, but not
294
+ // LedgerRequestExpandedAccountsOnly. This is because the
295
+ // LedgerRequestExpandedTransactionsBinary type is a superset of
296
+ // LedgerRequestExpandedTransactionsOnly, but not of the other.
297
+ // This is why LedgerRequestExpandedTransactionsBinary is listed
298
+ // first in the type list.
299
+ //
300
+ // Here is an example using real data:
301
+ // LedgerRequestExpandedTransactionsBinary = {
302
+ // command: 'ledger',
303
+ // ledger_index: 'validated',
304
+ // expand: true,
305
+ // transactions: true,
306
+ // binary: true,
307
+ // }
308
+ // LedgerRequestExpandedTransactionsOnly = {
309
+ // command: 'ledger',
310
+ // ledger_index: 'validated',
311
+ // expand: true,
312
+ // transactions: true,
313
+ // }
314
+ // LedgerRequestExpandedAccountsOnly = {
315
+ // command: 'ledger',
316
+ // ledger_index: 'validated',
317
+ // accounts: true,
318
+ // expand: true,
319
+ // }
320
+ // LedgerRequest = {
321
+ // command: 'ledger',
322
+ // ledger_index: 'validated',
323
+ // }
324
+ //
325
+ // The type with the most parameters set should be listed first. In this
326
+ // case LedgerRequestExpandedTransactionsBinary has the most parameters (`expand`, `transactions`, and `binary`)
327
+ // set, so it is listed first. When TypeScript tries to match the type of
328
+ // a request to a response, it will try to match the request type to the
329
+ // response type in the order they are listed. So, if we have a request
330
+ // with the following parameters:
331
+ // {
332
+ // command: 'ledger',
333
+ // ledger_index: 'validated',
334
+ // expand: true,
335
+ // transactions: true,
336
+ // binary: true,
337
+ // }
338
+ // TypeScript will first try to match the request type to
339
+ // LedgerRequestExpandedTransactionsBinary, which will succeed. It will
340
+ // then try to match the response type to LedgerResponseExpanded, which
341
+ // will also succeed. If we had listed LedgerRequestExpandedTransactionsOnly
342
+ // first, TypeScript would have tried to match the request type to
343
+ // LedgerRequestExpandedTransactionsOnly, which would have succeeded, but
344
+ // then we'd get the wrong response type, LedgerResponse, instead of
345
+ // LedgerResponseExpanded.
346
+ T extends LedgerRequestExpandedTransactionsBinary
347
+ ? LedgerResponse
348
+ : T extends LedgerRequestExpandedAccountsAndTransactions
349
+ ? LedgerResponseExpanded
350
+ : T extends LedgerRequestExpandedTransactionsOnly
351
+ ? LedgerResponseExpanded
352
+ : T extends LedgerRequestExpandedAccountsOnly
353
+ ? LedgerResponseExpanded
354
+ : T extends LedgerRequest
355
+ ? LedgerResponse
356
+ : T extends LedgerClosedRequest
357
+ ? LedgerClosedResponse
358
+ : T extends LedgerCurrentRequest
359
+ ? LedgerCurrentResponse
360
+ : T extends LedgerDataRequest
361
+ ? LedgerDataResponse
362
+ : T extends LedgerEntryRequest
363
+ ? LedgerEntryResponse
364
+ : T extends SubmitRequest
365
+ ? SubmitResponse
366
+ : T extends SubmitMultisignedRequest
367
+ ? SubmitMultisignedResponse
368
+ : T extends TransactionEntryRequest
369
+ ? TransactionEntryResponse
370
+ : T extends TxRequest
371
+ ? TxResponse
372
+ : T extends BookOffersRequest
373
+ ? BookOffersResponse
374
+ : T extends DepositAuthorizedRequest
375
+ ? DepositAuthorizedResponse
376
+ : T extends PathFindRequest
377
+ ? PathFindResponse
378
+ : T extends RipplePathFindRequest
379
+ ? RipplePathFindResponse
380
+ : T extends ChannelVerifyRequest
381
+ ? ChannelVerifyResponse
382
+ : T extends SubscribeRequest
383
+ ? SubscribeResponse
384
+ : T extends UnsubscribeRequest
385
+ ? UnsubscribeResponse
386
+ : T extends FeeRequest
387
+ ? FeeResponse
388
+ : T extends ManifestRequest
389
+ ? ManifestResponse
390
+ : T extends ServerInfoRequest
391
+ ? ServerInfoResponse
392
+ : T extends ServerStateRequest
393
+ ? ServerStateResponse
394
+ : T extends ServerDefinitionsRequest
395
+ ? ServerDefinitionsResponse
396
+ : T extends PingRequest
397
+ ? PingResponse
398
+ : T extends RandomRequest
399
+ ? RandomResponse
400
+ : T extends NFTBuyOffersRequest
401
+ ? NFTBuyOffersResponse
402
+ : T extends NFTSellOffersRequest
403
+ ? NFTSellOffersResponse
404
+ : T extends NFTInfoRequest
405
+ ? NFTInfoResponse
406
+ : T extends NFTHistoryRequest
407
+ ? NFTHistoryResponse
408
+ : Response
409
+
410
+ export type MarkerRequest = Request & {
411
+ limit?: number
412
+ marker?: unknown
413
+ }
414
+
415
+ export type MarkerResponse = Response & {
416
+ result: {
417
+ marker?: unknown
418
+ }
419
+ }
420
+
421
+ export type RequestAllResponseMap<T> = T extends AccountChannelsRequest
422
+ ? AccountChannelsResponse
423
+ : T extends AccountLinesRequest
424
+ ? AccountLinesResponse
425
+ : T extends AccountObjectsRequest
426
+ ? AccountObjectsResponse
427
+ : T extends AccountOffersRequest
428
+ ? AccountOffersResponse
429
+ : T extends AccountTxRequest
430
+ ? AccountTxResponse
431
+ : T extends LedgerDataRequest
432
+ ? LedgerDataResponse
433
+ : T extends AccountTxRequest
434
+ ? AccountTxResponse
435
+ : T extends BookOffersRequest
436
+ ? BookOffersResponse
437
+ : MarkerResponse
438
+
262
439
  export {
263
440
  // Allow users to define their own requests and responses. This is useful for releasing experimental versions
264
441
  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
  }
@@ -1,4 +1,4 @@
1
- import { Transaction } from '../transactions'
1
+ import { SubmittableTransaction } from '../transactions'
2
2
 
3
3
  import { BaseRequest, BaseResponse } from './baseMethod'
4
4
 
@@ -39,7 +39,7 @@ export interface SubmitResponse extends BaseResponse {
39
39
  /** The complete transaction in hex string format. */
40
40
  tx_blob: string
41
41
  /** The complete transaction in JSON format. */
42
- tx_json: Transaction & { hash?: string }
42
+ tx_json: SubmittableTransaction & { hash?: string }
43
43
  /**
44
44
  * The value true indicates that the transaction was applied, queued,
45
45
  * broadcast, or kept for later. The value `false` indicates that none of
@@ -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
@@ -1,6 +1,5 @@
1
1
  import { Transaction, TransactionMetadata } from '../transactions'
2
2
  import { BaseTransaction } from '../transactions/common'
3
- import { PseudoTransaction } from '../transactions/transaction'
4
3
 
5
4
  import { BaseRequest, BaseResponse } from './baseMethod'
6
5
 
@@ -47,9 +46,8 @@ export interface TxRequest extends BaseRequest {
47
46
  *
48
47
  * @category Responses
49
48
  */
50
- export interface TxResponse<
51
- T extends BaseTransaction = Transaction | PseudoTransaction,
52
- > extends BaseResponse {
49
+ export interface TxResponse<T extends BaseTransaction = Transaction>
50
+ extends BaseResponse {
53
51
  result: {
54
52
  /** The SHA-512 hash of the transaction. */
55
53
  hash: string
@@ -61,7 +59,7 @@ export interface TxResponse<
61
59
  ledger_index?: number
62
60
  /** Transaction metadata, which describes the results of the transaction.
63
61
  * Can be undefined if a transaction has not been validated yet. */
64
- meta?: TransactionMetadata | string
62
+ meta?: TransactionMetadata<T> | string
65
63
  /**
66
64
  * If true, this data comes from a validated ledger version; if omitted or.
67
65
  * 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
  *