xrpl 3.0.0 → 4.0.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 (292) hide show
  1. package/README.md +3 -3
  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 +424 -893
  5. package/build/xrpl-latest.js.map +1 -1
  6. package/dist/npm/Wallet/defaultFaucets.d.ts +1 -2
  7. package/dist/npm/Wallet/defaultFaucets.d.ts.map +1 -1
  8. package/dist/npm/Wallet/defaultFaucets.js +0 -5
  9. package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
  10. package/dist/npm/Wallet/fundWallet.d.ts.map +1 -1
  11. package/dist/npm/Wallet/fundWallet.js +1 -5
  12. package/dist/npm/Wallet/fundWallet.js.map +1 -1
  13. package/dist/npm/client/RequestManager.d.ts +5 -4
  14. package/dist/npm/client/RequestManager.d.ts.map +1 -1
  15. package/dist/npm/client/RequestManager.js.map +1 -1
  16. package/dist/npm/client/connection.d.ts +2 -2
  17. package/dist/npm/client/connection.d.ts.map +1 -1
  18. package/dist/npm/client/connection.js.map +1 -1
  19. package/dist/npm/client/index.d.ts +4 -3
  20. package/dist/npm/client/index.d.ts.map +1 -1
  21. package/dist/npm/client/index.js +17 -10
  22. package/dist/npm/client/index.js.map +1 -1
  23. package/dist/npm/client/partialPayment.d.ts +2 -1
  24. package/dist/npm/client/partialPayment.d.ts.map +1 -1
  25. package/dist/npm/client/partialPayment.js +10 -3
  26. package/dist/npm/client/partialPayment.js.map +1 -1
  27. package/dist/npm/models/common/index.d.ts +13 -0
  28. package/dist/npm/models/common/index.d.ts.map +1 -1
  29. package/dist/npm/models/common/index.js +4 -0
  30. package/dist/npm/models/common/index.js.map +1 -1
  31. package/dist/npm/models/ledger/AMM.d.ts +2 -2
  32. package/dist/npm/models/ledger/AMM.d.ts.map +1 -1
  33. package/dist/npm/models/ledger/Amendments.d.ts +2 -2
  34. package/dist/npm/models/ledger/Amendments.d.ts.map +1 -1
  35. package/dist/npm/models/ledger/BaseLedgerEntry.d.ts +3 -3
  36. package/dist/npm/models/ledger/BaseLedgerEntry.d.ts.map +1 -1
  37. package/dist/npm/models/ledger/DirectoryNode.d.ts +2 -2
  38. package/dist/npm/models/ledger/DirectoryNode.d.ts.map +1 -1
  39. package/dist/npm/models/ledger/FeeSettings.d.ts +2 -2
  40. package/dist/npm/models/ledger/FeeSettings.d.ts.map +1 -1
  41. package/dist/npm/models/ledger/Ledger.d.ts +11 -2
  42. package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
  43. package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
  44. package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
  45. package/dist/npm/models/ledger/LedgerHashes.d.ts +2 -2
  46. package/dist/npm/models/ledger/LedgerHashes.d.ts.map +1 -1
  47. package/dist/npm/models/ledger/NegativeUNL.d.ts +2 -2
  48. package/dist/npm/models/ledger/NegativeUNL.d.ts.map +1 -1
  49. package/dist/npm/models/ledger/Oracle.d.ts +12 -0
  50. package/dist/npm/models/ledger/Oracle.d.ts.map +1 -0
  51. package/dist/npm/models/ledger/Oracle.js +3 -0
  52. package/dist/npm/models/ledger/Oracle.js.map +1 -0
  53. package/dist/npm/models/ledger/RippleState.d.ts +2 -1
  54. package/dist/npm/models/ledger/RippleState.d.ts.map +1 -1
  55. package/dist/npm/models/ledger/RippleState.js +1 -0
  56. package/dist/npm/models/ledger/RippleState.js.map +1 -1
  57. package/dist/npm/models/ledger/index.d.ts +3 -2
  58. package/dist/npm/models/ledger/index.d.ts.map +1 -1
  59. package/dist/npm/models/ledger/index.js.map +1 -1
  60. package/dist/npm/models/methods/accountChannels.d.ts +1 -1
  61. package/dist/npm/models/methods/accountChannels.d.ts.map +1 -1
  62. package/dist/npm/models/methods/accountInfo.d.ts +17 -4
  63. package/dist/npm/models/methods/accountInfo.d.ts.map +1 -1
  64. package/dist/npm/models/methods/accountTx.d.ts +11 -5
  65. package/dist/npm/models/methods/accountTx.d.ts.map +1 -1
  66. package/dist/npm/models/methods/feature.d.ts +28 -0
  67. package/dist/npm/models/methods/feature.d.ts.map +1 -0
  68. package/dist/npm/models/methods/feature.js +3 -0
  69. package/dist/npm/models/methods/feature.js.map +1 -0
  70. package/dist/npm/models/methods/getAggregatePrice.d.ts +31 -0
  71. package/dist/npm/models/methods/getAggregatePrice.d.ts.map +1 -0
  72. package/dist/npm/models/methods/getAggregatePrice.js +3 -0
  73. package/dist/npm/models/methods/getAggregatePrice.js.map +1 -0
  74. package/dist/npm/models/methods/index.d.ts +15 -11
  75. package/dist/npm/models/methods/index.d.ts.map +1 -1
  76. package/dist/npm/models/methods/ledger.d.ts +17 -5
  77. package/dist/npm/models/methods/ledger.d.ts.map +1 -1
  78. package/dist/npm/models/methods/nftsByIssuer.d.ts +19 -0
  79. package/dist/npm/models/methods/nftsByIssuer.d.ts.map +1 -0
  80. package/dist/npm/models/methods/nftsByIssuer.js +3 -0
  81. package/dist/npm/models/methods/nftsByIssuer.js.map +1 -0
  82. package/dist/npm/models/methods/submitMultisigned.d.ts +16 -5
  83. package/dist/npm/models/methods/submitMultisigned.d.ts.map +1 -1
  84. package/dist/npm/models/methods/tx.d.ts +20 -8
  85. package/dist/npm/models/methods/tx.d.ts.map +1 -1
  86. package/dist/npm/models/transactions/AMMDeposit.d.ts +3 -1
  87. package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -1
  88. package/dist/npm/models/transactions/AMMDeposit.js +1 -0
  89. package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
  90. package/dist/npm/models/transactions/index.d.ts +2 -0
  91. package/dist/npm/models/transactions/index.d.ts.map +1 -1
  92. package/dist/npm/models/transactions/index.js.map +1 -1
  93. package/dist/npm/models/transactions/metadata.d.ts +3 -0
  94. package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
  95. package/dist/npm/models/transactions/metadata.js.map +1 -1
  96. package/dist/npm/models/transactions/oracleDelete.d.ts +7 -0
  97. package/dist/npm/models/transactions/oracleDelete.d.ts.map +1 -0
  98. package/dist/npm/models/transactions/oracleDelete.js +10 -0
  99. package/dist/npm/models/transactions/oracleDelete.js.map +1 -0
  100. package/dist/npm/models/transactions/oracleSet.d.ts +13 -0
  101. package/dist/npm/models/transactions/oracleSet.d.ts.map +1 -0
  102. package/dist/npm/models/transactions/oracleSet.js +59 -0
  103. package/dist/npm/models/transactions/oracleSet.js.map +1 -0
  104. package/dist/npm/models/transactions/payment.d.ts +2 -2
  105. package/dist/npm/models/transactions/payment.js +1 -1
  106. package/dist/npm/models/transactions/transaction.d.ts +3 -1
  107. package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
  108. package/dist/npm/models/transactions/transaction.js +8 -0
  109. package/dist/npm/models/transactions/transaction.js.map +1 -1
  110. package/dist/npm/snippets/src/claimPayChannel.js +1 -1
  111. package/dist/npm/snippets/src/claimPayChannel.js.map +1 -1
  112. package/dist/npm/snippets/src/sendEscrow.js +1 -1
  113. package/dist/npm/snippets/src/sendEscrow.js.map +1 -1
  114. package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
  115. package/dist/npm/src/Wallet/defaultFaucets.d.ts +1 -2
  116. package/dist/npm/src/Wallet/defaultFaucets.d.ts.map +1 -1
  117. package/dist/npm/src/Wallet/defaultFaucets.js +0 -5
  118. package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
  119. package/dist/npm/src/Wallet/fundWallet.d.ts.map +1 -1
  120. package/dist/npm/src/Wallet/fundWallet.js +1 -5
  121. package/dist/npm/src/Wallet/fundWallet.js.map +1 -1
  122. package/dist/npm/src/client/RequestManager.d.ts +5 -4
  123. package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
  124. package/dist/npm/src/client/RequestManager.js.map +1 -1
  125. package/dist/npm/src/client/connection.d.ts +2 -2
  126. package/dist/npm/src/client/connection.d.ts.map +1 -1
  127. package/dist/npm/src/client/connection.js.map +1 -1
  128. package/dist/npm/src/client/index.d.ts +4 -3
  129. package/dist/npm/src/client/index.d.ts.map +1 -1
  130. package/dist/npm/src/client/index.js +17 -10
  131. package/dist/npm/src/client/index.js.map +1 -1
  132. package/dist/npm/src/client/partialPayment.d.ts +2 -1
  133. package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
  134. package/dist/npm/src/client/partialPayment.js +10 -3
  135. package/dist/npm/src/client/partialPayment.js.map +1 -1
  136. package/dist/npm/src/models/common/index.d.ts +13 -0
  137. package/dist/npm/src/models/common/index.d.ts.map +1 -1
  138. package/dist/npm/src/models/common/index.js +4 -0
  139. package/dist/npm/src/models/common/index.js.map +1 -1
  140. package/dist/npm/src/models/ledger/AMM.d.ts +2 -2
  141. package/dist/npm/src/models/ledger/AMM.d.ts.map +1 -1
  142. package/dist/npm/src/models/ledger/Amendments.d.ts +2 -2
  143. package/dist/npm/src/models/ledger/Amendments.d.ts.map +1 -1
  144. package/dist/npm/src/models/ledger/BaseLedgerEntry.d.ts +3 -3
  145. package/dist/npm/src/models/ledger/BaseLedgerEntry.d.ts.map +1 -1
  146. package/dist/npm/src/models/ledger/DirectoryNode.d.ts +2 -2
  147. package/dist/npm/src/models/ledger/DirectoryNode.d.ts.map +1 -1
  148. package/dist/npm/src/models/ledger/FeeSettings.d.ts +2 -2
  149. package/dist/npm/src/models/ledger/FeeSettings.d.ts.map +1 -1
  150. package/dist/npm/src/models/ledger/Ledger.d.ts +11 -2
  151. package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
  152. package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
  153. package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
  154. package/dist/npm/src/models/ledger/LedgerHashes.d.ts +2 -2
  155. package/dist/npm/src/models/ledger/LedgerHashes.d.ts.map +1 -1
  156. package/dist/npm/src/models/ledger/NegativeUNL.d.ts +2 -2
  157. package/dist/npm/src/models/ledger/NegativeUNL.d.ts.map +1 -1
  158. package/dist/npm/src/models/ledger/Oracle.d.ts +12 -0
  159. package/dist/npm/src/models/ledger/Oracle.d.ts.map +1 -0
  160. package/dist/npm/src/models/ledger/Oracle.js +3 -0
  161. package/dist/npm/src/models/ledger/Oracle.js.map +1 -0
  162. package/dist/npm/src/models/ledger/RippleState.d.ts +2 -1
  163. package/dist/npm/src/models/ledger/RippleState.d.ts.map +1 -1
  164. package/dist/npm/src/models/ledger/RippleState.js +1 -0
  165. package/dist/npm/src/models/ledger/RippleState.js.map +1 -1
  166. package/dist/npm/src/models/ledger/index.d.ts +3 -2
  167. package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
  168. package/dist/npm/src/models/ledger/index.js.map +1 -1
  169. package/dist/npm/src/models/methods/accountChannels.d.ts +1 -1
  170. package/dist/npm/src/models/methods/accountChannels.d.ts.map +1 -1
  171. package/dist/npm/src/models/methods/accountInfo.d.ts +17 -4
  172. package/dist/npm/src/models/methods/accountInfo.d.ts.map +1 -1
  173. package/dist/npm/src/models/methods/accountTx.d.ts +11 -5
  174. package/dist/npm/src/models/methods/accountTx.d.ts.map +1 -1
  175. package/dist/npm/src/models/methods/feature.d.ts +28 -0
  176. package/dist/npm/src/models/methods/feature.d.ts.map +1 -0
  177. package/dist/npm/src/models/methods/feature.js +3 -0
  178. package/dist/npm/src/models/methods/feature.js.map +1 -0
  179. package/dist/npm/src/models/methods/getAggregatePrice.d.ts +31 -0
  180. package/dist/npm/src/models/methods/getAggregatePrice.d.ts.map +1 -0
  181. package/dist/npm/src/models/methods/getAggregatePrice.js +3 -0
  182. package/dist/npm/src/models/methods/getAggregatePrice.js.map +1 -0
  183. package/dist/npm/src/models/methods/index.d.ts +15 -11
  184. package/dist/npm/src/models/methods/index.d.ts.map +1 -1
  185. package/dist/npm/src/models/methods/ledger.d.ts +17 -5
  186. package/dist/npm/src/models/methods/ledger.d.ts.map +1 -1
  187. package/dist/npm/src/models/methods/nftsByIssuer.d.ts +19 -0
  188. package/dist/npm/src/models/methods/nftsByIssuer.d.ts.map +1 -0
  189. package/dist/npm/src/models/methods/nftsByIssuer.js +3 -0
  190. package/dist/npm/src/models/methods/nftsByIssuer.js.map +1 -0
  191. package/dist/npm/src/models/methods/submitMultisigned.d.ts +16 -5
  192. package/dist/npm/src/models/methods/submitMultisigned.d.ts.map +1 -1
  193. package/dist/npm/src/models/methods/tx.d.ts +20 -8
  194. package/dist/npm/src/models/methods/tx.d.ts.map +1 -1
  195. package/dist/npm/src/models/transactions/AMMDeposit.d.ts +3 -1
  196. package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -1
  197. package/dist/npm/src/models/transactions/AMMDeposit.js +1 -0
  198. package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
  199. package/dist/npm/src/models/transactions/index.d.ts +2 -0
  200. package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
  201. package/dist/npm/src/models/transactions/index.js.map +1 -1
  202. package/dist/npm/src/models/transactions/metadata.d.ts +3 -0
  203. package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
  204. package/dist/npm/src/models/transactions/metadata.js.map +1 -1
  205. package/dist/npm/src/models/transactions/oracleDelete.d.ts +7 -0
  206. package/dist/npm/src/models/transactions/oracleDelete.d.ts.map +1 -0
  207. package/dist/npm/src/models/transactions/oracleDelete.js +10 -0
  208. package/dist/npm/src/models/transactions/oracleDelete.js.map +1 -0
  209. package/dist/npm/src/models/transactions/oracleSet.d.ts +13 -0
  210. package/dist/npm/src/models/transactions/oracleSet.d.ts.map +1 -0
  211. package/dist/npm/src/models/transactions/oracleSet.js +59 -0
  212. package/dist/npm/src/models/transactions/oracleSet.js.map +1 -0
  213. package/dist/npm/src/models/transactions/payment.d.ts +2 -2
  214. package/dist/npm/src/models/transactions/payment.js +1 -1
  215. package/dist/npm/src/models/transactions/transaction.d.ts +3 -1
  216. package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
  217. package/dist/npm/src/models/transactions/transaction.js +8 -0
  218. package/dist/npm/src/models/transactions/transaction.js.map +1 -1
  219. package/dist/npm/src/sugar/autofill.d.ts +1 -1
  220. package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
  221. package/dist/npm/src/sugar/autofill.js +2 -4
  222. package/dist/npm/src/sugar/autofill.js.map +1 -1
  223. package/dist/npm/src/sugar/getFeeXrp.d.ts +1 -1
  224. package/dist/npm/src/sugar/getFeeXrp.d.ts.map +1 -1
  225. package/dist/npm/src/sugar/getFeeXrp.js +3 -2
  226. package/dist/npm/src/sugar/getFeeXrp.js.map +1 -1
  227. package/dist/npm/src/sugar/submit.d.ts.map +1 -1
  228. package/dist/npm/src/sugar/submit.js.map +1 -1
  229. package/dist/npm/src/utils/hashes/hashLedger.d.ts +4 -3
  230. package/dist/npm/src/utils/hashes/hashLedger.d.ts.map +1 -1
  231. package/dist/npm/src/utils/hashes/hashLedger.js.map +1 -1
  232. package/dist/npm/src/utils/index.d.ts +2 -1
  233. package/dist/npm/src/utils/index.d.ts.map +1 -1
  234. package/dist/npm/src/utils/index.js.map +1 -1
  235. package/dist/npm/sugar/autofill.d.ts +1 -1
  236. package/dist/npm/sugar/autofill.d.ts.map +1 -1
  237. package/dist/npm/sugar/autofill.js +2 -4
  238. package/dist/npm/sugar/autofill.js.map +1 -1
  239. package/dist/npm/sugar/getFeeXrp.d.ts +1 -1
  240. package/dist/npm/sugar/getFeeXrp.d.ts.map +1 -1
  241. package/dist/npm/sugar/getFeeXrp.js +3 -2
  242. package/dist/npm/sugar/getFeeXrp.js.map +1 -1
  243. package/dist/npm/sugar/submit.d.ts.map +1 -1
  244. package/dist/npm/sugar/submit.js.map +1 -1
  245. package/dist/npm/utils/hashes/hashLedger.d.ts +4 -3
  246. package/dist/npm/utils/hashes/hashLedger.d.ts.map +1 -1
  247. package/dist/npm/utils/hashes/hashLedger.js.map +1 -1
  248. package/dist/npm/utils/index.d.ts +2 -1
  249. package/dist/npm/utils/index.d.ts.map +1 -1
  250. package/dist/npm/utils/index.js.map +1 -1
  251. package/package.json +7 -8
  252. package/src/Wallet/defaultFaucets.ts +0 -6
  253. package/src/Wallet/fundWallet.ts +0 -1
  254. package/src/client/RequestManager.ts +17 -12
  255. package/src/client/connection.ts +7 -5
  256. package/src/client/index.ts +79 -21
  257. package/src/client/partialPayment.ts +34 -13
  258. package/src/models/common/index.ts +41 -0
  259. package/src/models/ledger/AMM.ts +2 -2
  260. package/src/models/ledger/Amendments.ts +2 -2
  261. package/src/models/ledger/BaseLedgerEntry.ts +9 -5
  262. package/src/models/ledger/DirectoryNode.ts +2 -2
  263. package/src/models/ledger/FeeSettings.ts +4 -2
  264. package/src/models/ledger/Ledger.ts +46 -9
  265. package/src/models/ledger/LedgerEntry.ts +3 -0
  266. package/src/models/ledger/LedgerHashes.ts +2 -4
  267. package/src/models/ledger/NegativeUNL.ts +2 -2
  268. package/src/models/ledger/Oracle.ts +43 -0
  269. package/src/models/ledger/RippleState.ts +2 -0
  270. package/src/models/ledger/index.ts +4 -1
  271. package/src/models/methods/accountChannels.ts +64 -1
  272. package/src/models/methods/accountInfo.ts +58 -12
  273. package/src/models/methods/accountTx.ts +49 -8
  274. package/src/models/methods/feature.ts +68 -0
  275. package/src/models/methods/getAggregatePrice.ts +119 -0
  276. package/src/models/methods/index.ts +79 -23
  277. package/src/models/methods/ledger.ts +41 -5
  278. package/src/models/methods/nftsByIssuer.ts +68 -0
  279. package/src/models/methods/submitMultisigned.ts +48 -16
  280. package/src/models/methods/tx.ts +74 -22
  281. package/src/models/transactions/AMMDeposit.ts +2 -0
  282. package/src/models/transactions/index.ts +2 -0
  283. package/src/models/transactions/metadata.ts +1 -0
  284. package/src/models/transactions/oracleDelete.ts +32 -0
  285. package/src/models/transactions/oracleSet.ts +176 -0
  286. package/src/models/transactions/payment.ts +2 -2
  287. package/src/models/transactions/transaction.ts +12 -0
  288. package/src/sugar/autofill.ts +4 -10
  289. package/src/sugar/getFeeXrp.ts +6 -3
  290. package/src/sugar/submit.ts +5 -3
  291. package/src/utils/hashes/hashLedger.ts +8 -5
  292. package/src/utils/index.ts +2 -1
@@ -40,6 +40,7 @@ export interface DeletedNode {
40
40
  DeletedNode: {
41
41
  LedgerEntryType: string
42
42
  LedgerIndex: string
43
+ PreviousFields?: { [field: string]: unknown }
43
44
  FinalFields: { [field: string]: unknown }
44
45
  }
45
46
  }
@@ -0,0 +1,32 @@
1
+ import {
2
+ BaseTransaction,
3
+ isNumber,
4
+ validateBaseTransaction,
5
+ validateRequiredField,
6
+ } from './common'
7
+
8
+ /**
9
+ * Delete an Oracle ledger entry.
10
+ *
11
+ * @category Transaction Models
12
+ */
13
+ export interface OracleDelete extends BaseTransaction {
14
+ TransactionType: 'OracleDelete'
15
+
16
+ /**
17
+ * A unique identifier of the price oracle for the Account.
18
+ */
19
+ OracleDocumentID: number
20
+ }
21
+
22
+ /**
23
+ * Verify the form and type of a OracleDelete at runtime.
24
+ *
25
+ * @param tx - A OracleDelete Transaction.
26
+ * @throws When the OracleDelete is malformed.
27
+ */
28
+ export function validateOracleDelete(tx: Record<string, unknown>): void {
29
+ validateBaseTransaction(tx)
30
+
31
+ validateRequiredField(tx, 'OracleDocumentID', isNumber)
32
+ }
@@ -0,0 +1,176 @@
1
+ import { ValidationError } from '../../errors'
2
+ import { PriceData } from '../common'
3
+
4
+ import {
5
+ BaseTransaction,
6
+ isNumber,
7
+ isString,
8
+ validateBaseTransaction,
9
+ validateOptionalField,
10
+ validateRequiredField,
11
+ } from './common'
12
+
13
+ const PRICE_DATA_SERIES_MAX_LENGTH = 10
14
+ const SCALE_MAX = 10
15
+
16
+ /**
17
+ * Creates a new Oracle ledger entry or updates the fields of an existing one, using the Oracle ID.
18
+ *
19
+ * The oracle provider must complete these steps before submitting this transaction:
20
+ * 1. Create or own the XRPL account in the Owner field and have enough XRP to meet the reserve and transaction fee requirements.
21
+ * 2. Publish the XRPL account public key, so it can be used for verification by dApps.
22
+ * 3. Publish a registry of available price oracles with their unique OracleDocumentID.
23
+ *
24
+ * @category Transaction Models
25
+ */
26
+ export interface OracleSet extends BaseTransaction {
27
+ TransactionType: 'OracleSet'
28
+
29
+ /**
30
+ * A unique identifier of the price oracle for the Account.
31
+ */
32
+ OracleDocumentID: number
33
+
34
+ /**
35
+ * The time the data was last updated, represented as a unix timestamp in seconds.
36
+ */
37
+ LastUpdateTime: number
38
+
39
+ /**
40
+ * An array of up to 10 PriceData objects, each representing the price information
41
+ * for a token pair. More than five PriceData objects require two owner reserves.
42
+ */
43
+ PriceDataSeries: PriceData[]
44
+
45
+ /**
46
+ * An arbitrary value that identifies an oracle provider, such as Chainlink, Band,
47
+ * or DIA. This field is a string, up to 256 ASCII hex encoded characters (0x20-0x7E).
48
+ * This field is required when creating a new Oracle ledger entry, but is optional for updates.
49
+ */
50
+ Provider?: string
51
+
52
+ /**
53
+ * An optional Universal Resource Identifier to reference price data off-chain. This field is limited to 256 bytes.
54
+ */
55
+ URI?: string
56
+
57
+ /**
58
+ * Describes the type of asset, such as "currency", "commodity", or "index". This field is a string, up to 16 ASCII
59
+ * hex encoded characters (0x20-0x7E). This field is required when creating a new Oracle ledger entry, but is optional
60
+ * for updates.
61
+ */
62
+ AssetClass?: string
63
+ }
64
+
65
+ /**
66
+ * Verify the form and type of a OracleSet at runtime.
67
+ *
68
+ * @param tx - A OracleSet Transaction.
69
+ * @throws When the OracleSet is malformed.
70
+ */
71
+ // eslint-disable-next-line max-lines-per-function -- necessary to validate many fields
72
+ export function validateOracleSet(tx: Record<string, unknown>): void {
73
+ validateBaseTransaction(tx)
74
+
75
+ validateRequiredField(tx, 'OracleDocumentID', isNumber)
76
+
77
+ validateRequiredField(tx, 'LastUpdateTime', isNumber)
78
+
79
+ validateOptionalField(tx, 'Provider', isString)
80
+
81
+ validateOptionalField(tx, 'URI', isString)
82
+
83
+ validateOptionalField(tx, 'AssetClass', isString)
84
+
85
+ // eslint-disable-next-line max-lines-per-function -- necessary to validate many fields
86
+ validateRequiredField(tx, 'PriceDataSeries', (value) => {
87
+ if (!Array.isArray(value)) {
88
+ throw new ValidationError('OracleSet: PriceDataSeries must be an array')
89
+ }
90
+
91
+ if (value.length > PRICE_DATA_SERIES_MAX_LENGTH) {
92
+ throw new ValidationError(
93
+ `OracleSet: PriceDataSeries must have at most ${PRICE_DATA_SERIES_MAX_LENGTH} PriceData objects`,
94
+ )
95
+ }
96
+
97
+ // TODO: add support for handling inner objects easier (similar to validateRequiredField/validateOptionalField)
98
+ for (const priceData of value) {
99
+ if (typeof priceData !== 'object') {
100
+ throw new ValidationError(
101
+ 'OracleSet: PriceDataSeries must be an array of objects',
102
+ )
103
+ }
104
+
105
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
106
+ if (priceData.PriceData == null) {
107
+ throw new ValidationError(
108
+ 'OracleSet: PriceDataSeries must have a `PriceData` object',
109
+ )
110
+ }
111
+
112
+ // check if priceData only has PriceData
113
+ if (Object.keys(priceData).length !== 1) {
114
+ throw new ValidationError(
115
+ 'OracleSet: PriceDataSeries must only have a single PriceData object',
116
+ )
117
+ }
118
+
119
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
120
+ if (typeof priceData.PriceData.BaseAsset !== 'string') {
121
+ throw new ValidationError(
122
+ 'OracleSet: PriceDataSeries must have a `BaseAsset` string',
123
+ )
124
+ }
125
+
126
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
127
+ if (typeof priceData.PriceData.QuoteAsset !== 'string') {
128
+ throw new ValidationError(
129
+ 'OracleSet: PriceDataSeries must have a `QuoteAsset` string',
130
+ )
131
+ }
132
+
133
+ // Either AssetPrice and Scale are both present or both excluded
134
+ if (
135
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
136
+ (priceData.PriceData.AssetPrice == null) !==
137
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
138
+ (priceData.PriceData.Scale == null)
139
+ ) {
140
+ throw new ValidationError(
141
+ 'OracleSet: PriceDataSeries must have both `AssetPrice` and `Scale` if any are present',
142
+ )
143
+ }
144
+
145
+ if (
146
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
147
+ 'AssetPrice' in priceData.PriceData &&
148
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
149
+ !isNumber(priceData.PriceData.AssetPrice)
150
+ ) {
151
+ throw new ValidationError('OracleSet: invalid field AssetPrice')
152
+ }
153
+
154
+ if (
155
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
156
+ 'Scale' in priceData.PriceData &&
157
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
158
+ !isNumber(priceData.PriceData.Scale)
159
+ ) {
160
+ throw new ValidationError('OracleSet: invalid field Scale')
161
+ }
162
+
163
+ if (
164
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
165
+ priceData.PriceData.Scale < 0 ||
166
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we are validating the type
167
+ priceData.PriceData.Scale > SCALE_MAX
168
+ ) {
169
+ throw new ValidationError(
170
+ `OracleSet: Scale must be in range 0-${SCALE_MAX}`,
171
+ )
172
+ }
173
+ }
174
+ return true
175
+ })
176
+ }
@@ -26,7 +26,7 @@ export enum PaymentFlags {
26
26
  * This is intended to force the transaction to take arbitrage opportunities.
27
27
  * Most clients do not need this.
28
28
  */
29
- tfNoDirectRipple = 0x00010000,
29
+ tfNoRippleDirect = 0x00010000,
30
30
  /**
31
31
  * If the specified Amount cannot be sent without spending more than SendMax,
32
32
  * reduce the received amount instead of failing outright. See Partial.
@@ -88,7 +88,7 @@ export interface PaymentFlagsInterface extends GlobalFlags {
88
88
  * This is intended to force the transaction to take arbitrage opportunities.
89
89
  * Most clients do not need this.
90
90
  */
91
- tfNoDirectRipple?: boolean
91
+ tfNoRippleDirect?: boolean
92
92
  /**
93
93
  * If the specified Amount cannot be sent without spending more than SendMax,
94
94
  * reduce the received amount instead of failing outright. See Partial.
@@ -43,6 +43,8 @@ import {
43
43
  import { NFTokenMint, validateNFTokenMint } from './NFTokenMint'
44
44
  import { OfferCancel, validateOfferCancel } from './offerCancel'
45
45
  import { OfferCreate, validateOfferCreate } from './offerCreate'
46
+ import { OracleDelete, validateOracleDelete } from './oracleDelete'
47
+ import { OracleSet, validateOracleSet } from './oracleSet'
46
48
  import { Payment, validatePayment } from './payment'
47
49
  import {
48
50
  PaymentChannelClaim,
@@ -120,6 +122,8 @@ export type SubmittableTransaction =
120
122
  | NFTokenMint
121
123
  | OfferCancel
122
124
  | OfferCreate
125
+ | OracleDelete
126
+ | OracleSet
123
127
  | Payment
124
128
  | PaymentChannelClaim
125
129
  | PaymentChannelCreate
@@ -330,6 +334,14 @@ export function validate(transaction: Record<string, unknown>): void {
330
334
  validateOfferCreate(tx)
331
335
  break
332
336
 
337
+ case 'OracleDelete':
338
+ validateOracleDelete(tx)
339
+ break
340
+
341
+ case 'OracleSet':
342
+ validateOracleSet(tx)
343
+ break
344
+
333
345
  case 'Payment':
334
346
  validatePayment(tx)
335
347
  break
@@ -1,7 +1,7 @@
1
1
  import BigNumber from 'bignumber.js'
2
2
  import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
3
3
 
4
- import type { Client } from '..'
4
+ import { type Client } from '..'
5
5
  import { ValidationError, XrplError } from '../errors'
6
6
  import { AccountInfoRequest, AccountObjectsRequest } from '../models/methods'
7
7
  import { Transaction } from '../models/transactions'
@@ -17,7 +17,6 @@ const LEDGER_OFFSET = 20
17
17
  // Mainnet and testnet are exceptions. More context: https://github.com/XRPLF/rippled/pull/4370
18
18
  const RESTRICTED_NETWORKS = 1024
19
19
  const REQUIRED_NETWORKID_VERSION = '1.11.0'
20
- const HOOKS_TESTNET_ID = 21338
21
20
 
22
21
  /**
23
22
  * Determines whether the source rippled version is not later than the target rippled version.
@@ -87,8 +86,7 @@ function isNotLaterRippledVersion(source: string, target: string): boolean {
87
86
 
88
87
  /**
89
88
  * Determine if the transaction required a networkID to be valid.
90
- * Transaction needs networkID if later than restricted ID and either the network is hooks testnet
91
- * or build version is >= 1.11.0
89
+ * Transaction needs networkID if later than restricted ID and build version is >= 1.11.0
92
90
  *
93
91
  * @param client -- The connected client.
94
92
  * @returns True if required networkID, false otherwise.
@@ -99,12 +97,8 @@ export function txNeedsNetworkID(client: Client): boolean {
99
97
  client.networkID > RESTRICTED_NETWORKS
100
98
  ) {
101
99
  if (
102
- (client.buildVersion &&
103
- isNotLaterRippledVersion(
104
- REQUIRED_NETWORKID_VERSION,
105
- client.buildVersion,
106
- )) ||
107
- client.networkID === HOOKS_TESTNET_ID
100
+ client.buildVersion &&
101
+ isNotLaterRippledVersion(REQUIRED_NETWORKID_VERSION, client.buildVersion)
108
102
  ) {
109
103
  return true
110
104
  }
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js'
2
2
 
3
- import type { Client } from '..'
3
+ import { type Client } from '..'
4
4
  import { XrplError } from '../errors'
5
5
 
6
6
  const NUM_DECIMAL_PLACES = 6
@@ -20,8 +20,11 @@ export default async function getFeeXrp(
20
20
  ): Promise<string> {
21
21
  const feeCushion = cushion ?? client.feeCushion
22
22
 
23
- const serverInfo = (await client.request({ command: 'server_info' })).result
24
- .info
23
+ const serverInfo = (
24
+ await client.request({
25
+ command: 'server_info',
26
+ })
27
+ ).result.info
25
28
 
26
29
  const baseFee = serverInfo.validated_ledger?.base_fee_xrp
27
30
 
@@ -10,7 +10,7 @@ import type {
10
10
  } from '..'
11
11
  import { ValidationError, XrplError } from '../errors'
12
12
  import { Signer } from '../models/common'
13
- import { TxRequest, TxResponse } from '../models/methods'
13
+ import { TxResponse } from '../models/methods'
14
14
  import { BaseTransaction } from '../models/transactions/common'
15
15
 
16
16
  /** Approximate time for a ledger to close, in milliseconds */
@@ -129,7 +129,7 @@ export async function waitForFinalTransactionOutcome<
129
129
  }
130
130
 
131
131
  const txResponse = await client
132
- .request<TxRequest, TxResponse<T>>({
132
+ .request({
133
133
  command: 'tx',
134
134
  transaction: txHash,
135
135
  })
@@ -153,7 +153,9 @@ export async function waitForFinalTransactionOutcome<
153
153
  })
154
154
 
155
155
  if (txResponse.result.validated) {
156
- return txResponse
156
+ // TODO: resolve the type assertion below
157
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we know that txResponse is of type TxResponse
158
+ return txResponse as TxResponse<T>
157
159
  }
158
160
 
159
161
  return waitForFinalTransactionOutcome<T>(
@@ -8,8 +8,9 @@ import BigNumber from 'bignumber.js'
8
8
  import { decode, encode } from 'ripple-binary-codec'
9
9
 
10
10
  import { ValidationError, XrplError } from '../../errors'
11
- import type { Ledger } from '../../models/ledger'
11
+ import { APIVersion } from '../../models'
12
12
  import { LedgerEntry } from '../../models/ledger'
13
+ import { LedgerVersionMap } from '../../models/ledger/Ledger'
13
14
  import { Transaction, TransactionMetadata } from '../../models/transactions'
14
15
 
15
16
  import HashPrefix from './HashPrefix'
@@ -99,7 +100,9 @@ export function hashSignedTx(tx: Transaction | string): string {
99
100
  * @returns The hash of the ledger.
100
101
  * @category Utilities
101
102
  */
102
- export function hashLedgerHeader(ledgerHeader: Ledger): string {
103
+ export function hashLedgerHeader(
104
+ ledgerHeader: LedgerVersionMap<APIVersion>,
105
+ ): string {
103
106
  const prefix = HashPrefix.LEDGER.toString(HEX).toUpperCase()
104
107
 
105
108
  const ledger =
@@ -158,7 +161,7 @@ export function hashStateTree(entries: LedgerEntry[]): string {
158
161
  }
159
162
 
160
163
  function computeTransactionHash(
161
- ledger: Ledger,
164
+ ledger: LedgerVersionMap<APIVersion>,
162
165
  options: HashLedgerHeaderOptions,
163
166
  ): string {
164
167
  const { transaction_hash } = ledger
@@ -188,7 +191,7 @@ function computeTransactionHash(
188
191
  }
189
192
 
190
193
  function computeStateHash(
191
- ledger: Ledger,
194
+ ledger: LedgerVersionMap<APIVersion>,
192
195
  options: HashLedgerHeaderOptions,
193
196
  ): string {
194
197
  const { account_hash } = ledger
@@ -222,7 +225,7 @@ function computeStateHash(
222
225
  * @category Utilities
223
226
  */
224
227
  function hashLedger(
225
- ledger: Ledger,
228
+ ledger: LedgerVersionMap<APIVersion>,
226
229
  options: {
227
230
  computeTreeHashes?: boolean
228
231
  } = {},
@@ -23,6 +23,7 @@ import {
23
23
  } from 'ripple-binary-codec'
24
24
  import { verify as verifyKeypairSignature } from 'ripple-keypairs'
25
25
 
26
+ import type { APIVersion } from '../models'
26
27
  import { LedgerEntry } from '../models/ledger'
27
28
  import { Response } from '../models/methods'
28
29
  import { PaymentChannelClaim } from '../models/transactions/paymentChannelClaim'
@@ -157,7 +158,7 @@ function isValidAddress(address: string): boolean {
157
158
  * @returns Whether the response has more pages of data.
158
159
  * @category Utilities
159
160
  */
160
- function hasNextPage(response: Response): boolean {
161
+ function hasNextPage(response: Response<APIVersion>): boolean {
161
162
  // eslint-disable-next-line @typescript-eslint/dot-notation -- only checking if it exists
162
163
  return Boolean(response.result['marker'])
163
164
  }