ripple-binary-codec 0.2.7 → 1.0.0-mpt-beta

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 (364) hide show
  1. package/README.md +104 -2
  2. package/dist/binary.d.ts +90 -0
  3. package/dist/binary.js +128 -0
  4. package/dist/binary.js.map +1 -0
  5. package/dist/coretypes.d.ts +9 -0
  6. package/dist/coretypes.js +48 -0
  7. package/dist/coretypes.js.map +1 -0
  8. package/dist/enums/bytes.d.ts +25 -0
  9. package/dist/enums/bytes.js +63 -0
  10. package/dist/enums/bytes.js.map +1 -0
  11. package/dist/enums/constants.d.ts +4 -0
  12. package/dist/enums/constants.js +8 -0
  13. package/dist/enums/constants.js.map +1 -0
  14. package/dist/enums/definitions.json +2956 -0
  15. package/dist/enums/field.d.ts +28 -0
  16. package/dist/enums/field.js +58 -0
  17. package/dist/enums/field.js.map +1 -0
  18. package/dist/enums/index.d.ts +12 -0
  19. package/dist/enums/index.js +31 -0
  20. package/dist/enums/index.js.map +1 -0
  21. package/{distrib/npm → dist/enums/src}/enums/definitions.json +1709 -438
  22. package/dist/enums/utils-renumber.d.ts +101 -0
  23. package/dist/enums/utils-renumber.js +127 -0
  24. package/dist/enums/utils-renumber.js.map +1 -0
  25. package/dist/enums/xrpl-definitions-base.d.ts +44 -0
  26. package/dist/enums/xrpl-definitions-base.js +59 -0
  27. package/dist/enums/xrpl-definitions-base.js.map +1 -0
  28. package/dist/enums/xrpl-definitions.d.ts +21 -0
  29. package/dist/enums/xrpl-definitions.js +29 -0
  30. package/dist/enums/xrpl-definitions.js.map +1 -0
  31. package/dist/hash-prefixes.d.ts +5 -0
  32. package/dist/hash-prefixes.js +41 -0
  33. package/dist/hash-prefixes.js.map +1 -0
  34. package/dist/hashes.d.ts +50 -0
  35. package/dist/hashes.js +76 -0
  36. package/dist/hashes.js.map +1 -0
  37. package/dist/index.d.ts +64 -0
  38. package/dist/index.js +123 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/ledger-hashes.d.ts +48 -0
  41. package/dist/ledger-hashes.js +141 -0
  42. package/dist/ledger-hashes.js.map +1 -0
  43. package/dist/quality.d.ts +21 -0
  44. package/dist/quality.js +42 -0
  45. package/dist/quality.js.map +1 -0
  46. package/dist/serdes/binary-parser.d.ts +100 -0
  47. package/dist/serdes/binary-parser.js +194 -0
  48. package/dist/serdes/binary-parser.js.map +1 -0
  49. package/dist/serdes/binary-serializer.d.ts +81 -0
  50. package/dist/serdes/binary-serializer.js +149 -0
  51. package/dist/serdes/binary-serializer.js.map +1 -0
  52. package/dist/shamap.d.ts +102 -0
  53. package/dist/shamap.js +172 -0
  54. package/dist/shamap.js.map +1 -0
  55. package/dist/src/binary.d.ts +90 -0
  56. package/dist/src/binary.js +128 -0
  57. package/dist/src/binary.js.map +1 -0
  58. package/dist/src/coretypes.d.ts +9 -0
  59. package/dist/src/coretypes.js +48 -0
  60. package/dist/src/coretypes.js.map +1 -0
  61. package/dist/src/enums/bytes.d.ts +25 -0
  62. package/dist/src/enums/bytes.js +63 -0
  63. package/dist/src/enums/bytes.js.map +1 -0
  64. package/dist/src/enums/constants.d.ts +4 -0
  65. package/dist/src/enums/constants.js +8 -0
  66. package/dist/src/enums/constants.js.map +1 -0
  67. package/dist/src/enums/definitions.json +2956 -0
  68. package/dist/src/enums/field.d.ts +28 -0
  69. package/dist/src/enums/field.js +58 -0
  70. package/dist/src/enums/field.js.map +1 -0
  71. package/dist/src/enums/index.d.ts +12 -0
  72. package/dist/src/enums/index.js +31 -0
  73. package/dist/src/enums/index.js.map +1 -0
  74. package/dist/src/enums/utils-renumber.d.ts +101 -0
  75. package/dist/src/enums/utils-renumber.js +127 -0
  76. package/dist/src/enums/utils-renumber.js.map +1 -0
  77. package/dist/src/enums/xrpl-definitions-base.d.ts +44 -0
  78. package/dist/src/enums/xrpl-definitions-base.js +59 -0
  79. package/dist/src/enums/xrpl-definitions-base.js.map +1 -0
  80. package/dist/src/enums/xrpl-definitions.d.ts +21 -0
  81. package/dist/src/enums/xrpl-definitions.js +29 -0
  82. package/dist/src/enums/xrpl-definitions.js.map +1 -0
  83. package/dist/src/hash-prefixes.d.ts +5 -0
  84. package/dist/src/hash-prefixes.js +41 -0
  85. package/dist/src/hash-prefixes.js.map +1 -0
  86. package/dist/src/hashes.d.ts +50 -0
  87. package/dist/src/hashes.js +76 -0
  88. package/dist/src/hashes.js.map +1 -0
  89. package/dist/src/index.d.ts +64 -0
  90. package/dist/src/index.js +123 -0
  91. package/dist/src/index.js.map +1 -0
  92. package/dist/src/ledger-hashes.d.ts +48 -0
  93. package/dist/src/ledger-hashes.js +141 -0
  94. package/dist/src/ledger-hashes.js.map +1 -0
  95. package/dist/src/quality.d.ts +21 -0
  96. package/dist/src/quality.js +42 -0
  97. package/dist/src/quality.js.map +1 -0
  98. package/dist/src/serdes/binary-parser.d.ts +100 -0
  99. package/dist/src/serdes/binary-parser.js +194 -0
  100. package/dist/src/serdes/binary-parser.js.map +1 -0
  101. package/dist/src/serdes/binary-serializer.d.ts +81 -0
  102. package/dist/src/serdes/binary-serializer.js +149 -0
  103. package/dist/src/serdes/binary-serializer.js.map +1 -0
  104. package/dist/src/shamap.d.ts +102 -0
  105. package/dist/src/shamap.js +172 -0
  106. package/dist/src/shamap.js.map +1 -0
  107. package/dist/src/types/account-id.d.ts +35 -0
  108. package/dist/src/types/account-id.js +69 -0
  109. package/dist/src/types/account-id.js.map +1 -0
  110. package/dist/src/types/amount.d.ts +91 -0
  111. package/dist/src/types/amount.js +289 -0
  112. package/dist/src/types/amount.js.map +1 -0
  113. package/dist/src/types/blob.d.ts +24 -0
  114. package/dist/src/types/blob.js +40 -0
  115. package/dist/src/types/blob.js.map +1 -0
  116. package/dist/src/types/currency.d.ts +28 -0
  117. package/dist/src/types/currency.js +127 -0
  118. package/dist/src/types/currency.js.map +1 -0
  119. package/dist/src/types/hash-128.d.ts +16 -0
  120. package/dist/src/types/hash-128.js +32 -0
  121. package/dist/src/types/hash-128.js.map +1 -0
  122. package/dist/src/types/hash-160.d.ts +10 -0
  123. package/dist/src/types/hash-160.js +19 -0
  124. package/dist/src/types/hash-160.js.map +1 -0
  125. package/dist/src/types/hash-192.d.ts +10 -0
  126. package/dist/src/types/hash-192.js +19 -0
  127. package/dist/src/types/hash-192.js.map +1 -0
  128. package/dist/src/types/hash-256.d.ts +10 -0
  129. package/dist/src/types/hash-256.js +16 -0
  130. package/dist/src/types/hash-256.js.map +1 -0
  131. package/dist/src/types/hash.d.ts +40 -0
  132. package/dist/src/types/hash.js +73 -0
  133. package/dist/src/types/hash.js.map +1 -0
  134. package/dist/src/types/index.d.ts +19 -0
  135. package/dist/src/types/index.js +64 -0
  136. package/dist/src/types/index.js.map +1 -0
  137. package/dist/src/types/issue.d.ts +38 -0
  138. package/dist/src/types/issue.js +81 -0
  139. package/dist/src/types/issue.js.map +1 -0
  140. package/dist/src/types/path-set.d.ts +36 -0
  141. package/dist/src/types/path-set.js +233 -0
  142. package/dist/src/types/path-set.js.map +1 -0
  143. package/dist/src/types/serialized-type.d.ts +70 -0
  144. package/dist/src/types/serialized-type.js +105 -0
  145. package/dist/src/types/serialized-type.js.map +1 -0
  146. package/dist/src/types/st-array.d.ts +31 -0
  147. package/dist/src/types/st-array.js +83 -0
  148. package/dist/src/types/st-array.js.map +1 -0
  149. package/dist/src/types/st-object.d.ts +32 -0
  150. package/dist/src/types/st-object.js +155 -0
  151. package/dist/src/types/st-object.js.map +1 -0
  152. package/dist/src/types/uint-16.d.ts +24 -0
  153. package/dist/src/types/uint-16.js +45 -0
  154. package/dist/src/types/uint-16.js.map +1 -0
  155. package/dist/src/types/uint-32.d.ts +24 -0
  156. package/dist/src/types/uint-32.js +50 -0
  157. package/dist/src/types/uint-32.js.map +1 -0
  158. package/dist/src/types/uint-64.d.ts +37 -0
  159. package/dist/src/types/uint-64.js +86 -0
  160. package/dist/src/types/uint-64.js.map +1 -0
  161. package/dist/src/types/uint-8.d.ts +24 -0
  162. package/dist/src/types/uint-8.js +46 -0
  163. package/dist/src/types/uint-8.js.map +1 -0
  164. package/dist/src/types/uint.d.ts +29 -0
  165. package/dist/src/types/uint.js +47 -0
  166. package/dist/src/types/uint.js.map +1 -0
  167. package/dist/src/types/vector-256.d.ts +30 -0
  168. package/dist/src/types/vector-256.js +73 -0
  169. package/dist/src/types/vector-256.js.map +1 -0
  170. package/dist/src/types/xchain-bridge.d.ts +44 -0
  171. package/dist/src/types/xchain-bridge.js +102 -0
  172. package/dist/src/types/xchain-bridge.js.map +1 -0
  173. package/dist/src/utils.d.ts +47 -0
  174. package/dist/src/utils.js +137 -0
  175. package/dist/src/utils.js.map +1 -0
  176. package/dist/tsconfig.tsbuildinfo +1 -0
  177. package/dist/types/account-id.d.ts +35 -0
  178. package/dist/types/account-id.js +69 -0
  179. package/dist/types/account-id.js.map +1 -0
  180. package/dist/types/amount.d.ts +91 -0
  181. package/dist/types/amount.js +289 -0
  182. package/dist/types/amount.js.map +1 -0
  183. package/dist/types/blob.d.ts +24 -0
  184. package/dist/types/blob.js +40 -0
  185. package/dist/types/blob.js.map +1 -0
  186. package/dist/types/currency.d.ts +28 -0
  187. package/dist/types/currency.js +127 -0
  188. package/dist/types/currency.js.map +1 -0
  189. package/dist/types/hash-128.d.ts +16 -0
  190. package/dist/types/hash-128.js +32 -0
  191. package/dist/types/hash-128.js.map +1 -0
  192. package/dist/types/hash-160.d.ts +10 -0
  193. package/dist/types/hash-160.js +19 -0
  194. package/dist/types/hash-160.js.map +1 -0
  195. package/dist/types/hash-192.d.ts +10 -0
  196. package/dist/types/hash-192.js +19 -0
  197. package/dist/types/hash-192.js.map +1 -0
  198. package/dist/types/hash-256.d.ts +10 -0
  199. package/dist/types/hash-256.js +16 -0
  200. package/dist/types/hash-256.js.map +1 -0
  201. package/dist/types/hash.d.ts +40 -0
  202. package/dist/types/hash.js +73 -0
  203. package/dist/types/hash.js.map +1 -0
  204. package/dist/types/index.d.ts +19 -0
  205. package/dist/types/index.js +64 -0
  206. package/dist/types/index.js.map +1 -0
  207. package/dist/types/issue.d.ts +38 -0
  208. package/dist/types/issue.js +81 -0
  209. package/dist/types/issue.js.map +1 -0
  210. package/dist/types/path-set.d.ts +36 -0
  211. package/dist/types/path-set.js +233 -0
  212. package/dist/types/path-set.js.map +1 -0
  213. package/dist/types/serialized-type.d.ts +70 -0
  214. package/dist/types/serialized-type.js +105 -0
  215. package/dist/types/serialized-type.js.map +1 -0
  216. package/dist/types/st-array.d.ts +31 -0
  217. package/dist/types/st-array.js +83 -0
  218. package/dist/types/st-array.js.map +1 -0
  219. package/dist/types/st-object.d.ts +32 -0
  220. package/dist/types/st-object.js +155 -0
  221. package/dist/types/st-object.js.map +1 -0
  222. package/dist/types/uint-16.d.ts +24 -0
  223. package/dist/types/uint-16.js +45 -0
  224. package/dist/types/uint-16.js.map +1 -0
  225. package/dist/types/uint-32.d.ts +24 -0
  226. package/dist/types/uint-32.js +50 -0
  227. package/dist/types/uint-32.js.map +1 -0
  228. package/dist/types/uint-64.d.ts +37 -0
  229. package/dist/types/uint-64.js +86 -0
  230. package/dist/types/uint-64.js.map +1 -0
  231. package/dist/types/uint-8.d.ts +24 -0
  232. package/dist/types/uint-8.js +46 -0
  233. package/dist/types/uint-8.js.map +1 -0
  234. package/dist/types/uint.d.ts +29 -0
  235. package/dist/types/uint.js +47 -0
  236. package/dist/types/uint.js.map +1 -0
  237. package/dist/types/vector-256.d.ts +30 -0
  238. package/dist/types/vector-256.js +73 -0
  239. package/dist/types/vector-256.js.map +1 -0
  240. package/dist/types/xchain-bridge.d.ts +44 -0
  241. package/dist/types/xchain-bridge.js +102 -0
  242. package/dist/types/xchain-bridge.js.map +1 -0
  243. package/dist/utils.d.ts +47 -0
  244. package/dist/utils.js +137 -0
  245. package/dist/utils.js.map +1 -0
  246. package/package.json +28 -33
  247. package/src/README.md +5 -0
  248. package/src/binary.ts +194 -0
  249. package/src/coretypes.ts +31 -0
  250. package/src/enums/README.md +144 -0
  251. package/src/enums/bytes.ts +74 -0
  252. package/src/enums/constants.ts +4 -0
  253. package/src/enums/definitions.json +2961 -0
  254. package/src/enums/field.ts +84 -0
  255. package/src/enums/index.ts +34 -0
  256. package/src/enums/utils-renumber.ts +134 -0
  257. package/src/enums/xrpl-definitions-base.ts +111 -0
  258. package/src/enums/xrpl-definitions.ts +32 -0
  259. package/src/hash-prefixes.ts +40 -0
  260. package/src/hashes.ts +75 -0
  261. package/src/index.ts +153 -0
  262. package/src/ledger-hashes.ts +191 -0
  263. package/src/quality.ts +38 -0
  264. package/src/serdes/binary-parser.ts +224 -0
  265. package/src/serdes/binary-serializer.ts +166 -0
  266. package/src/shamap.ts +186 -0
  267. package/src/types/account-id.ts +86 -0
  268. package/src/types/amount.ts +362 -0
  269. package/src/types/blob.ts +43 -0
  270. package/src/types/currency.ts +140 -0
  271. package/src/types/hash-128.ts +33 -0
  272. package/src/types/hash-160.ts +19 -0
  273. package/src/types/hash-192.ts +19 -0
  274. package/src/types/hash-256.ts +15 -0
  275. package/src/types/hash.ts +83 -0
  276. package/src/types/index.ts +66 -0
  277. package/src/types/issue.ts +96 -0
  278. package/src/types/path-set.ts +290 -0
  279. package/src/types/serialized-type.ts +122 -0
  280. package/src/types/st-array.ts +107 -0
  281. package/src/types/st-object.ts +192 -0
  282. package/src/types/uint-16.ts +53 -0
  283. package/src/types/uint-32.ts +59 -0
  284. package/src/types/uint-64.ts +104 -0
  285. package/src/types/uint-8.ts +52 -0
  286. package/src/types/uint.ts +60 -0
  287. package/src/types/vector-256.ts +79 -0
  288. package/src/types/xchain-bridge.ts +128 -0
  289. package/src/utils.ts +152 -0
  290. package/HISTORY.md +0 -66
  291. package/distrib/npm/binary.js +0 -68
  292. package/distrib/npm/coretypes.js +0 -22
  293. package/distrib/npm/enums/index.js +0 -125
  294. package/distrib/npm/enums/utils-renumber.js +0 -134
  295. package/distrib/npm/hash-prefixes.js +0 -30
  296. package/distrib/npm/hashes.js +0 -42
  297. package/distrib/npm/index.js +0 -72
  298. package/distrib/npm/ledger-hashes.js +0 -71
  299. package/distrib/npm/quality.js +0 -20
  300. package/distrib/npm/serdes/binary-parser.js +0 -98
  301. package/distrib/npm/serdes/binary-serializer.js +0 -106
  302. package/distrib/npm/shamap.js +0 -107
  303. package/distrib/npm/types/account-id.js +0 -41
  304. package/distrib/npm/types/amount.js +0 -215
  305. package/distrib/npm/types/blob.js +0 -28
  306. package/distrib/npm/types/currency.js +0 -91
  307. package/distrib/npm/types/hash-128.js +0 -10
  308. package/distrib/npm/types/hash-160.js +0 -10
  309. package/distrib/npm/types/hash-256.js +0 -15
  310. package/distrib/npm/types/hash.js +0 -45
  311. package/distrib/npm/types/index.js +0 -45
  312. package/distrib/npm/types/path-set.js +0 -112
  313. package/distrib/npm/types/serialized-type.js +0 -63
  314. package/distrib/npm/types/st-array.js +0 -37
  315. package/distrib/npm/types/st-object.js +0 -65
  316. package/distrib/npm/types/uint-16.js +0 -10
  317. package/distrib/npm/types/uint-32.js +0 -10
  318. package/distrib/npm/types/uint-64.js +0 -49
  319. package/distrib/npm/types/uint-8.js +0 -10
  320. package/distrib/npm/types/uint.js +0 -60
  321. package/distrib/npm/types/vector-256.js +0 -31
  322. package/distrib/npm/utils/bytes-utils.js +0 -112
  323. package/distrib/npm/utils/make-class.js +0 -83
  324. package/test/amount-test.js +0 -43
  325. package/test/binary-json-test.js +0 -43
  326. package/test/binary-parser-test.js +0 -341
  327. package/test/binary-serializer-test.js +0 -194
  328. package/test/bytes-utils-test.js +0 -72
  329. package/test/fixtures/account-tx-transactions.db +0 -0
  330. package/test/fixtures/codec-fixtures.json +0 -4466
  331. package/test/fixtures/data-driven-tests.json +0 -3721
  332. package/test/fixtures/delivermin-tx-binary.json +0 -1
  333. package/test/fixtures/delivermin-tx.json +0 -98
  334. package/test/fixtures/deposit-preauth-tx-binary.json +0 -1
  335. package/test/fixtures/deposit-preauth-tx-meta-binary.json +0 -1
  336. package/test/fixtures/deposit-preauth-tx.json +0 -58
  337. package/test/fixtures/escrow-cancel-binary.json +0 -1
  338. package/test/fixtures/escrow-cancel-tx.json +0 -6
  339. package/test/fixtures/escrow-create-binary.json +0 -1
  340. package/test/fixtures/escrow-create-tx.json +0 -10
  341. package/test/fixtures/escrow-finish-binary.json +0 -1
  342. package/test/fixtures/escrow-finish-meta-binary.json +0 -1
  343. package/test/fixtures/escrow-finish-tx.json +0 -95
  344. package/test/fixtures/ledger-full-38129.json +0 -1
  345. package/test/fixtures/ledger-full-40000.json +0 -1
  346. package/test/fixtures/payment-channel-claim-binary.json +0 -1
  347. package/test/fixtures/payment-channel-claim-tx.json +0 -8
  348. package/test/fixtures/payment-channel-create-binary.json +0 -1
  349. package/test/fixtures/payment-channel-create-tx.json +0 -11
  350. package/test/fixtures/payment-channel-fund-binary.json +0 -1
  351. package/test/fixtures/payment-channel-fund-tx.json +0 -7
  352. package/test/fixtures/signerlistset-tx-binary.json +0 -1
  353. package/test/fixtures/signerlistset-tx-meta-binary.json +0 -1
  354. package/test/fixtures/signerlistset-tx.json +0 -94
  355. package/test/hash-test.js +0 -58
  356. package/test/ledger-test.js +0 -26
  357. package/test/mocha.opts +0 -1
  358. package/test/quality-test.js +0 -16
  359. package/test/shamap-test.js +0 -88
  360. package/test/signing-data-encoding-test.js +0 -120
  361. package/test/tx-encode-decode-test.js +0 -124
  362. package/test/types-test.js +0 -38
  363. package/test/uint-test.js +0 -38
  364. package/test/utils.js +0 -93
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Quick script to re-number values
3
+ */
4
+ declare const input: {
5
+ temBAD_SEND_XRP_PATHS: number;
6
+ temBAD_SEQUENCE: number;
7
+ temBAD_SIGNATURE: number;
8
+ temBAD_SRC_ACCOUNT: number;
9
+ temBAD_TRANSFER_RATE: number;
10
+ temDST_IS_SRC: number;
11
+ temDST_NEEDED: number;
12
+ temINVALID: number;
13
+ temINVALID_FLAG: number;
14
+ temREDUNDANT: number;
15
+ temRIPPLE_EMPTY: number;
16
+ temDISABLED: number;
17
+ temBAD_SIGNER: number;
18
+ temBAD_QUORUM: number;
19
+ temBAD_WEIGHT: number;
20
+ temBAD_TICK_SIZE: number;
21
+ temINVALID_ACCOUNT_ID: number;
22
+ temCANNOT_PREAUTH_SELF: number;
23
+ temUNCERTAIN: number;
24
+ temUNKNOWN: number;
25
+ tefFAILURE: number;
26
+ tefALREADY: number;
27
+ tefBAD_ADD_AUTH: number;
28
+ tefBAD_AUTH: number;
29
+ tefBAD_LEDGER: number;
30
+ tefCREATED: number;
31
+ tefEXCEPTION: number;
32
+ tefINTERNAL: number;
33
+ tefNO_AUTH_REQUIRED: number;
34
+ tefPAST_SEQ: number;
35
+ tefWRONG_PRIOR: number;
36
+ tefMASTER_DISABLED: number;
37
+ tefMAX_LEDGER: number;
38
+ tefBAD_SIGNATURE: number;
39
+ tefBAD_QUORUM: number;
40
+ tefNOT_MULTI_SIGNING: number;
41
+ tefBAD_AUTH_MASTER: number;
42
+ tefINVARIANT_FAILED: number;
43
+ tefTOO_BIG: number;
44
+ terRETRY: number;
45
+ terFUNDS_SPENT: number;
46
+ terINSUF_FEE_B: number;
47
+ terNO_ACCOUNT: number;
48
+ terNO_AUTH: number;
49
+ terNO_LINE: number;
50
+ terOWNERS: number;
51
+ terPRE_SEQ: number;
52
+ terLAST: number;
53
+ terNO_RIPPLE: number;
54
+ terQUEUED: number;
55
+ tesSUCCESS: number;
56
+ tecCLAIM: number;
57
+ tecPATH_PARTIAL: number;
58
+ tecUNFUNDED_ADD: number;
59
+ tecUNFUNDED_OFFER: number;
60
+ tecUNFUNDED_PAYMENT: number;
61
+ tecFAILED_PROCESSING: number;
62
+ tecDIR_FULL: number;
63
+ tecINSUF_RESERVE_LINE: number;
64
+ tecINSUF_RESERVE_OFFER: number;
65
+ tecNO_DST: number;
66
+ tecNO_DST_INSUF_XRP: number;
67
+ tecNO_LINE_INSUF_RESERVE: number;
68
+ tecNO_LINE_REDUNDANT: number;
69
+ tecPATH_DRY: number;
70
+ tecUNFUNDED: number;
71
+ tecNO_ALTERNATIVE_KEY: number;
72
+ tecNO_REGULAR_KEY: number;
73
+ tecOWNERS: number;
74
+ tecNO_ISSUER: number;
75
+ tecNO_AUTH: number;
76
+ tecNO_LINE: number;
77
+ tecINSUFF_FEE: number;
78
+ tecFROZEN: number;
79
+ tecNO_TARGET: number;
80
+ tecNO_PERMISSION: number;
81
+ tecNO_ENTRY: number;
82
+ tecINSUFFICIENT_RESERVE: number;
83
+ tecNEED_MASTER_KEY: number;
84
+ tecDST_TAG_NEEDED: number;
85
+ tecINTERNAL: number;
86
+ tecOVERSIZE: number;
87
+ tecCRYPTOCONDITION_ERROR: number;
88
+ tecINVARIANT_FAILED: number;
89
+ tecEXPIRED: number;
90
+ tecDUPLICATE: number;
91
+ tecKILLED: number;
92
+ tecHAS_OBLIGATIONS: number;
93
+ tecTOO_SOON: number;
94
+ };
95
+ declare let startingFromTemBADSENDXRPPATHS: number;
96
+ declare let startingFromTefFAILURE: number;
97
+ declare let startingFromTerRETRY: number;
98
+ declare const tesSUCCESS = 0;
99
+ declare let startingFromTecCLAIM: number;
100
+ declare const startingFromTecDIRFULL = 121;
101
+ declare let previousKey: string;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ /**
3
+ * Quick script to re-number values
4
+ */
5
+ const input = {
6
+ temBAD_SEND_XRP_PATHS: -283,
7
+ temBAD_SEQUENCE: -282,
8
+ temBAD_SIGNATURE: -281,
9
+ temBAD_SRC_ACCOUNT: -280,
10
+ temBAD_TRANSFER_RATE: -279,
11
+ temDST_IS_SRC: -278,
12
+ temDST_NEEDED: -277,
13
+ temINVALID: -276,
14
+ temINVALID_FLAG: -275,
15
+ temREDUNDANT: -274,
16
+ temRIPPLE_EMPTY: -273,
17
+ temDISABLED: -272,
18
+ temBAD_SIGNER: -271,
19
+ temBAD_QUORUM: -270,
20
+ temBAD_WEIGHT: -269,
21
+ temBAD_TICK_SIZE: -268,
22
+ temINVALID_ACCOUNT_ID: -267,
23
+ temCANNOT_PREAUTH_SELF: -266,
24
+ temUNCERTAIN: -265,
25
+ temUNKNOWN: -264,
26
+ tefFAILURE: -199,
27
+ tefALREADY: -198,
28
+ tefBAD_ADD_AUTH: -197,
29
+ tefBAD_AUTH: -196,
30
+ tefBAD_LEDGER: -195,
31
+ tefCREATED: -194,
32
+ tefEXCEPTION: -193,
33
+ tefINTERNAL: -192,
34
+ tefNO_AUTH_REQUIRED: -191,
35
+ tefPAST_SEQ: -190,
36
+ tefWRONG_PRIOR: -189,
37
+ tefMASTER_DISABLED: -188,
38
+ tefMAX_LEDGER: -187,
39
+ tefBAD_SIGNATURE: -186,
40
+ tefBAD_QUORUM: -185,
41
+ tefNOT_MULTI_SIGNING: -184,
42
+ tefBAD_AUTH_MASTER: -183,
43
+ tefINVARIANT_FAILED: -182,
44
+ tefTOO_BIG: -181,
45
+ terRETRY: -99,
46
+ terFUNDS_SPENT: -98,
47
+ terINSUF_FEE_B: -97,
48
+ terNO_ACCOUNT: -96,
49
+ terNO_AUTH: -95,
50
+ terNO_LINE: -94,
51
+ terOWNERS: -93,
52
+ terPRE_SEQ: -92,
53
+ terLAST: -91,
54
+ terNO_RIPPLE: -90,
55
+ terQUEUED: -89,
56
+ tesSUCCESS: 0,
57
+ tecCLAIM: 100,
58
+ tecPATH_PARTIAL: 101,
59
+ tecUNFUNDED_ADD: 102,
60
+ tecUNFUNDED_OFFER: 103,
61
+ tecUNFUNDED_PAYMENT: 104,
62
+ tecFAILED_PROCESSING: 105,
63
+ tecDIR_FULL: 121,
64
+ tecINSUF_RESERVE_LINE: 122,
65
+ tecINSUF_RESERVE_OFFER: 123,
66
+ tecNO_DST: 124,
67
+ tecNO_DST_INSUF_XRP: 125,
68
+ tecNO_LINE_INSUF_RESERVE: 126,
69
+ tecNO_LINE_REDUNDANT: 127,
70
+ tecPATH_DRY: 128,
71
+ tecUNFUNDED: 129,
72
+ tecNO_ALTERNATIVE_KEY: 130,
73
+ tecNO_REGULAR_KEY: 131,
74
+ tecOWNERS: 132,
75
+ tecNO_ISSUER: 133,
76
+ tecNO_AUTH: 134,
77
+ tecNO_LINE: 135,
78
+ tecINSUFF_FEE: 136,
79
+ tecFROZEN: 137,
80
+ tecNO_TARGET: 138,
81
+ tecNO_PERMISSION: 139,
82
+ tecNO_ENTRY: 140,
83
+ tecINSUFFICIENT_RESERVE: 141,
84
+ tecNEED_MASTER_KEY: 142,
85
+ tecDST_TAG_NEEDED: 143,
86
+ tecINTERNAL: 144,
87
+ tecOVERSIZE: 145,
88
+ tecCRYPTOCONDITION_ERROR: 146,
89
+ tecINVARIANT_FAILED: 147,
90
+ tecEXPIRED: 148,
91
+ tecDUPLICATE: 149,
92
+ tecKILLED: 150,
93
+ tecHAS_OBLIGATIONS: 151,
94
+ tecTOO_SOON: 152,
95
+ };
96
+ let startingFromTemBADSENDXRPPATHS = -284;
97
+ let startingFromTefFAILURE = -199;
98
+ let startingFromTerRETRY = -99;
99
+ const tesSUCCESS = 0;
100
+ let startingFromTecCLAIM = 100;
101
+ const startingFromTecDIRFULL = 121;
102
+ let previousKey = 'tem';
103
+ Object.keys(input).forEach((key) => {
104
+ if (key.substring(0, 3) !== previousKey.substring(0, 3)) {
105
+ console.log();
106
+ previousKey = key;
107
+ }
108
+ if (key.substring(0, 3) === 'tem') {
109
+ console.log(` "${key}": ${startingFromTemBADSENDXRPPATHS++},`);
110
+ }
111
+ else if (key.substring(0, 3) === 'tef') {
112
+ console.log(` "${key}": ${startingFromTefFAILURE++},`);
113
+ }
114
+ else if (key.substring(0, 3) === 'ter') {
115
+ console.log(` "${key}": ${startingFromTerRETRY++},`);
116
+ }
117
+ else if (key.substring(0, 3) === 'tes') {
118
+ console.log(` "${key}": ${tesSUCCESS},`);
119
+ }
120
+ else if (key.substring(0, 3) === 'tec') {
121
+ if (key === 'tecDIR_FULL') {
122
+ startingFromTecCLAIM = startingFromTecDIRFULL;
123
+ }
124
+ console.log(` "${key}": ${startingFromTecCLAIM++},`);
125
+ }
126
+ });
127
+ //# sourceMappingURL=utils-renumber.js.map
@@ -0,0 +1 @@
1
+ {"version":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SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,UAAU,GAAG,CAAC,CAAA;KAC5C;SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,IAAI,GAAG,KAAK,aAAa,EAAE;YACzB,oBAAoB,GAAG,sBAAsB,CAAA;SAC9C;QACD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,oBAAoB,EAAE,GAAG,CAAC,CAAA;KACxD;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { SerializedType } from '../types/serialized-type';
2
+ import { Bytes, BytesLookup } from './bytes';
3
+ import { FieldInfo, FieldLookup, FieldInstance } from './field';
4
+ interface DefinitionsData {
5
+ TYPES: Record<string, number>;
6
+ LEDGER_ENTRY_TYPES: Record<string, number>;
7
+ FIELDS: (string | FieldInfo)[][];
8
+ TRANSACTION_RESULTS: Record<string, number>;
9
+ TRANSACTION_TYPES: Record<string, number>;
10
+ }
11
+ /**
12
+ * Stores the various types and fields for rippled to be used to encode/decode information later on.
13
+ * XrplDefinitions should be instantiated instead of this class.
14
+ */
15
+ declare class XrplDefinitionsBase {
16
+ field: FieldLookup;
17
+ ledgerEntryType: BytesLookup;
18
+ type: BytesLookup;
19
+ transactionResult: BytesLookup;
20
+ transactionType: BytesLookup;
21
+ transactionNames: string[];
22
+ dataTypes: Record<string, typeof SerializedType>;
23
+ /**
24
+ * Present rippled types in a typed and updatable format.
25
+ * For an example of the input format see `definitions.json`
26
+ * To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
27
+ *
28
+ * See the definitions.test.js file for examples of how to create your own updated definitions.json.
29
+ *
30
+ * @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
31
+ * @param types - A list of type objects with the same name as the fields defined.
32
+ * You can use the coreTypes object if you are not adding new types.
33
+ */
34
+ constructor(enums: DefinitionsData, types: Record<string, typeof SerializedType>);
35
+ /**
36
+ * Associates each Field to a corresponding class that TypeScript can recognize.
37
+ *
38
+ * @param types a list of type objects with the same name as the fields defined.
39
+ * Defaults to xrpl.js's core type definitions.
40
+ */
41
+ associateTypes(types: Record<string, typeof SerializedType>): void;
42
+ getAssociatedTypes(): Record<string, typeof SerializedType>;
43
+ }
44
+ export { DefinitionsData, XrplDefinitionsBase, FieldLookup, FieldInfo, FieldInstance, Bytes, BytesLookup, };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BytesLookup = exports.Bytes = exports.FieldLookup = exports.XrplDefinitionsBase = void 0;
4
+ const bytes_1 = require("./bytes");
5
+ Object.defineProperty(exports, "Bytes", { enumerable: true, get: function () { return bytes_1.Bytes; } });
6
+ Object.defineProperty(exports, "BytesLookup", { enumerable: true, get: function () { return bytes_1.BytesLookup; } });
7
+ const field_1 = require("./field");
8
+ Object.defineProperty(exports, "FieldLookup", { enumerable: true, get: function () { return field_1.FieldLookup; } });
9
+ const constants_1 = require("./constants");
10
+ /**
11
+ * Stores the various types and fields for rippled to be used to encode/decode information later on.
12
+ * XrplDefinitions should be instantiated instead of this class.
13
+ */
14
+ class XrplDefinitionsBase {
15
+ /**
16
+ * Present rippled types in a typed and updatable format.
17
+ * For an example of the input format see `definitions.json`
18
+ * To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
19
+ *
20
+ * See the definitions.test.js file for examples of how to create your own updated definitions.json.
21
+ *
22
+ * @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
23
+ * @param types - A list of type objects with the same name as the fields defined.
24
+ * You can use the coreTypes object if you are not adding new types.
25
+ */
26
+ constructor(enums, types) {
27
+ this.type = new bytes_1.BytesLookup(enums.TYPES, constants_1.TYPE_WIDTH);
28
+ this.ledgerEntryType = new bytes_1.BytesLookup(enums.LEDGER_ENTRY_TYPES, constants_1.LEDGER_ENTRY_WIDTH);
29
+ this.transactionType = new bytes_1.BytesLookup(enums.TRANSACTION_TYPES, constants_1.TRANSACTION_TYPE_WIDTH);
30
+ this.transactionResult = new bytes_1.BytesLookup(enums.TRANSACTION_RESULTS, constants_1.TRANSACTION_RESULT_WIDTH);
31
+ this.field = new field_1.FieldLookup(enums.FIELDS, enums.TYPES);
32
+ this.transactionNames = Object.entries(enums.TRANSACTION_TYPES)
33
+ .filter(([_key, value]) => value >= 0)
34
+ .map(([key, _value]) => key);
35
+ this.dataTypes = {}; // Filled in via associateTypes
36
+ this.associateTypes(types);
37
+ }
38
+ /**
39
+ * Associates each Field to a corresponding class that TypeScript can recognize.
40
+ *
41
+ * @param types a list of type objects with the same name as the fields defined.
42
+ * Defaults to xrpl.js's core type definitions.
43
+ */
44
+ associateTypes(types) {
45
+ // Overwrite any existing type definitions with the given types
46
+ this.dataTypes = Object.assign({}, this.dataTypes, types);
47
+ Object.values(this.field).forEach((field) => {
48
+ field.associatedType = this.dataTypes[field.type.name];
49
+ });
50
+ this.field['TransactionType'].associatedType = this.transactionType;
51
+ this.field['TransactionResult'].associatedType = this.transactionResult;
52
+ this.field['LedgerEntryType'].associatedType = this.ledgerEntryType;
53
+ }
54
+ getAssociatedTypes() {
55
+ return this.dataTypes;
56
+ }
57
+ }
58
+ exports.XrplDefinitionsBase = XrplDefinitionsBase;
59
+ //# sourceMappingURL=xrpl-definitions-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xrpl-definitions-base.js","sourceRoot":"","sources":["../../src/enums/xrpl-definitions-base.ts"],"names":[],"mappings":";;;AACA,mCAA4C;AA2G1C,sFA3GO,aAAK,OA2GP;AACL,4FA5Gc,mBAAW,OA4Gd;AA3Gb,mCAA+D;AAuG7D,4FAvGkB,mBAAW,OAuGlB;AAtGb,2CAKoB;AAUpB;;;GAGG;AACH,MAAM,mBAAmB;IAgBvB;;;;;;;;;;OA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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAA;QACnE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAA;QACvE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAA;IACrE,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;CACF;AAIC,kDAAmB"}
@@ -0,0 +1,21 @@
1
+ import { type DefinitionsData, XrplDefinitionsBase } from './xrpl-definitions-base';
2
+ import { SerializedType } from '../types/serialized-type';
3
+ /**
4
+ * Stores the various types and fields for rippled to be used to encode/decode information later on.
5
+ * Should be used instead of XrplDefinitionsBase since this defines default `types` for serializing/deserializing
6
+ * ledger data.
7
+ */
8
+ export declare class XrplDefinitions extends XrplDefinitionsBase {
9
+ /**
10
+ * Present rippled types in a typed and updatable format.
11
+ * For an example of the input format see `definitions.json`
12
+ * To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
13
+ *
14
+ * See the definitions.test.js file for examples of how to create your own updated definitions.json.
15
+ *
16
+ * @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
17
+ * @param additionalTypes - A list of SerializedType objects with the same name as the fields defined.
18
+ * These types will be included in addition to the coreTypes used on mainnet.
19
+ */
20
+ constructor(enums: DefinitionsData, additionalTypes?: Record<string, typeof SerializedType>);
21
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XrplDefinitions = void 0;
4
+ const xrpl_definitions_base_1 = require("./xrpl-definitions-base");
5
+ const types_1 = require("../types");
6
+ /**
7
+ * Stores the various types and fields for rippled to be used to encode/decode information later on.
8
+ * Should be used instead of XrplDefinitionsBase since this defines default `types` for serializing/deserializing
9
+ * ledger data.
10
+ */
11
+ class XrplDefinitions extends xrpl_definitions_base_1.XrplDefinitionsBase {
12
+ /**
13
+ * Present rippled types in a typed and updatable format.
14
+ * For an example of the input format see `definitions.json`
15
+ * To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
16
+ *
17
+ * See the definitions.test.js file for examples of how to create your own updated definitions.json.
18
+ *
19
+ * @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
20
+ * @param additionalTypes - A list of SerializedType objects with the same name as the fields defined.
21
+ * These types will be included in addition to the coreTypes used on mainnet.
22
+ */
23
+ constructor(enums, additionalTypes) {
24
+ const types = Object.assign({}, types_1.coreTypes, additionalTypes);
25
+ super(enums, types);
26
+ }
27
+ }
28
+ exports.XrplDefinitions = XrplDefinitions;
29
+ //# sourceMappingURL=xrpl-definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xrpl-definitions.js","sourceRoot":"","sources":["../../src/enums/xrpl-definitions.ts"],"names":[],"mappings":";;;AAAA,mEAGgC;AAChC,oCAAoC;AAGpC;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,2CAAmB;IACtD;;;;;;;;;;OAUG;IACH,YACE,KAAsB,EACtB,eAAuD;QAEvD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,iBAAS,EAAE,eAAe,CAAC,CAAA;QAC3D,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACrB,CAAC;CACF;AAnBD,0CAmBC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Maps HashPrefix names to their byte representation
3
+ */
4
+ declare const HashPrefix: Record<string, Uint8Array>;
5
+ export { HashPrefix };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HashPrefix = void 0;
4
+ const utils_1 = require("./utils");
5
+ /**
6
+ * Write a 32 bit integer to a Uint8Array
7
+ *
8
+ * @param uint32 32 bit integer to write to Uint8Array
9
+ * @returns a Uint8Array with the bytes representation of uint32
10
+ */
11
+ function bytes(uint32) {
12
+ const result = new Uint8Array(4);
13
+ (0, utils_1.writeUInt32BE)(result, uint32, 0);
14
+ return result;
15
+ }
16
+ /**
17
+ * Maps HashPrefix names to their byte representation
18
+ */
19
+ const HashPrefix = {
20
+ transactionID: bytes(0x54584e00),
21
+ // transaction plus metadata
22
+ transaction: bytes(0x534e4400),
23
+ // account state
24
+ accountStateEntry: bytes(0x4d4c4e00),
25
+ // inner node in tree
26
+ innerNode: bytes(0x4d494e00),
27
+ // ledger master data for signing
28
+ ledgerHeader: bytes(0x4c575200),
29
+ // inner transaction to sign
30
+ transactionSig: bytes(0x53545800),
31
+ // inner transaction to sign
32
+ transactionMultiSig: bytes(0x534d5400),
33
+ // validation for signing
34
+ validation: bytes(0x56414c00),
35
+ // proposal for signing
36
+ proposal: bytes(0x50525000),
37
+ // payment channel claim
38
+ paymentChannelClaim: bytes(0x434c4d00),
39
+ };
40
+ exports.HashPrefix = HashPrefix;
41
+ //# sourceMappingURL=hash-prefixes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-prefixes.js","sourceRoot":"","sources":["../src/hash-prefixes.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAEvC;;;;;GAKG;AACH,SAAS,KAAK,CAAC,MAAc;IAC3B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;IAChC,IAAA,qBAAa,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAChC,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAA+B;IAC7C,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;IAChC,4BAA4B;IAC5B,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC;IAC9B,gBAAgB;IAChB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC;IACpC,qBAAqB;IACrB,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC;IAC5B,iCAAiC;IACjC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC;IAC/B,4BAA4B;IAC5B,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC;IACjC,4BAA4B;IAC5B,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC;IACtC,yBAAyB;IACzB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;IAC7B,uBAAuB;IACvB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC;IAC3B,wBAAwB;IACxB,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC;CACvC,CAAA;AAEQ,gCAAU"}
@@ -0,0 +1,50 @@
1
+ import { Hash256 } from './types';
2
+ import { BytesList } from './serdes/binary-serializer';
3
+ /**
4
+ * Class for hashing with SHA512
5
+ * @extends BytesList So SerializedTypes can write bytes to a Sha512Half
6
+ */
7
+ declare class Sha512Half extends BytesList {
8
+ private hash;
9
+ /**
10
+ * Construct a new Sha512Hash and write bytes this.hash
11
+ *
12
+ * @param bytes bytes to write to this.hash
13
+ * @returns the new Sha512Hash object
14
+ */
15
+ static put(bytes: Uint8Array): Sha512Half;
16
+ /**
17
+ * Write bytes to an existing Sha512Hash
18
+ *
19
+ * @param bytes bytes to write to object
20
+ * @returns the Sha512 object
21
+ */
22
+ put(bytes: Uint8Array): Sha512Half;
23
+ /**
24
+ * Compute SHA512 hash and slice in half
25
+ *
26
+ * @returns half of a SHA512 hash
27
+ */
28
+ finish256(): Uint8Array;
29
+ /**
30
+ * Constructs a Hash256 from the Sha512Half object
31
+ *
32
+ * @returns a Hash256 object
33
+ */
34
+ finish(): Hash256;
35
+ }
36
+ /**
37
+ * compute SHA512 hash of a list of bytes
38
+ *
39
+ * @param args zero or more arguments to hash
40
+ * @returns the sha512half hash of the arguments.
41
+ */
42
+ declare function sha512Half(...args: Uint8Array[]): Uint8Array;
43
+ /**
44
+ * Construct a transactionID from a Serialized Transaction
45
+ *
46
+ * @param serialized bytes to hash
47
+ * @returns a Hash256 object
48
+ */
49
+ declare function transactionID(serialized: Uint8Array): Hash256;
50
+ export { Sha512Half, sha512Half, transactionID };
package/dist/hashes.js ADDED
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transactionID = exports.sha512Half = exports.Sha512Half = void 0;
4
+ const hash_prefixes_1 = require("./hash-prefixes");
5
+ const types_1 = require("./types");
6
+ const binary_serializer_1 = require("./serdes/binary-serializer");
7
+ const sha512_1 = require("@xrplf/isomorphic/sha512");
8
+ /**
9
+ * Class for hashing with SHA512
10
+ * @extends BytesList So SerializedTypes can write bytes to a Sha512Half
11
+ */
12
+ class Sha512Half extends binary_serializer_1.BytesList {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.hash = sha512_1.sha512.create();
16
+ }
17
+ /**
18
+ * Construct a new Sha512Hash and write bytes this.hash
19
+ *
20
+ * @param bytes bytes to write to this.hash
21
+ * @returns the new Sha512Hash object
22
+ */
23
+ static put(bytes) {
24
+ return new Sha512Half().put(bytes);
25
+ }
26
+ /**
27
+ * Write bytes to an existing Sha512Hash
28
+ *
29
+ * @param bytes bytes to write to object
30
+ * @returns the Sha512 object
31
+ */
32
+ put(bytes) {
33
+ this.hash.update(bytes);
34
+ return this;
35
+ }
36
+ /**
37
+ * Compute SHA512 hash and slice in half
38
+ *
39
+ * @returns half of a SHA512 hash
40
+ */
41
+ finish256() {
42
+ return Uint8Array.from(this.hash.digest().slice(0, 32));
43
+ }
44
+ /**
45
+ * Constructs a Hash256 from the Sha512Half object
46
+ *
47
+ * @returns a Hash256 object
48
+ */
49
+ finish() {
50
+ return new types_1.Hash256(this.finish256());
51
+ }
52
+ }
53
+ exports.Sha512Half = Sha512Half;
54
+ /**
55
+ * compute SHA512 hash of a list of bytes
56
+ *
57
+ * @param args zero or more arguments to hash
58
+ * @returns the sha512half hash of the arguments.
59
+ */
60
+ function sha512Half(...args) {
61
+ const hash = new Sha512Half();
62
+ args.forEach((a) => hash.put(a));
63
+ return hash.finish256();
64
+ }
65
+ exports.sha512Half = sha512Half;
66
+ /**
67
+ * Construct a transactionID from a Serialized Transaction
68
+ *
69
+ * @param serialized bytes to hash
70
+ * @returns a Hash256 object
71
+ */
72
+ function transactionID(serialized) {
73
+ return new types_1.Hash256(sha512Half(hash_prefixes_1.HashPrefix.transactionID, serialized));
74
+ }
75
+ exports.transactionID = transactionID;
76
+ //# sourceMappingURL=hashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashes.js","sourceRoot":"","sources":["../src/hashes.ts"],"names":[],"mappings":";;;AAAA,mDAA4C;AAC5C,mCAAiC;AACjC,kEAAsD;AACtD,qDAAiD;AAEjD;;;GAGG;AACH,MAAM,UAAW,SAAQ,6BAAS;IAAlC;;QACU,SAAI,GAAG,eAAM,CAAC,MAAM,EAAE,CAAA;IAwChC,CAAC;IAtCC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,KAAiB;QAC1B,OAAO,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,KAAiB;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACzD,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,eAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;IACtC,CAAC;CACF;AAwBQ,gCAAU;AAtBnB;;;;;GAKG;AACH,SAAS,UAAU,CAAC,GAAG,IAAkB;IACvC,MAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAA;IAC7B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAChC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAA;AACzB,CAAC;AAYoB,gCAAU;AAV/B;;;;;GAKG;AACH,SAAS,aAAa,CAAC,UAAsB;IAC3C,OAAO,IAAI,eAAO,CAAC,UAAU,CAAC,0BAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAA;AACtE,CAAC;AAEgC,sCAAa"}
@@ -0,0 +1,64 @@
1
+ import { decodeLedgerData } from './ledger-hashes';
2
+ import { JsonObject } from './types/serialized-type';
3
+ import { XrplDefinitionsBase, TRANSACTION_TYPES, DEFAULT_DEFINITIONS } from './enums';
4
+ import { XrplDefinitions } from './enums/xrpl-definitions';
5
+ import { coreTypes } from './types';
6
+ /**
7
+ * Decode a transaction
8
+ *
9
+ * @param binary hex-string of the encoded transaction
10
+ * @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
11
+ * @returns the JSON representation of the transaction
12
+ */
13
+ declare function decode(binary: string, definitions?: XrplDefinitionsBase): JsonObject;
14
+ /**
15
+ * Encode a transaction
16
+ *
17
+ * @param json The JSON representation of a transaction
18
+ * @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
19
+ *
20
+ * @returns A hex-string of the encoded transaction
21
+ */
22
+ declare function encode(json: object, definitions?: XrplDefinitionsBase): string;
23
+ /**
24
+ * Encode a transaction and prepare for signing
25
+ *
26
+ * @param json JSON object representing the transaction
27
+ * @param signer string representing the account to sign the transaction with
28
+ * @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
29
+ * @returns a hex string of the encoded transaction
30
+ */
31
+ declare function encodeForSigning(json: object, definitions?: XrplDefinitionsBase): string;
32
+ /**
33
+ * Encode a transaction and prepare for signing with a claim
34
+ *
35
+ * @param json JSON object representing the transaction
36
+ * @param signer string representing the account to sign the transaction with
37
+ * @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
38
+ * @returns a hex string of the encoded transaction
39
+ */
40
+ declare function encodeForSigningClaim(json: object): string;
41
+ /**
42
+ * Encode a transaction and prepare for multi-signing
43
+ *
44
+ * @param json JSON object representing the transaction
45
+ * @param signer string representing the account to sign the transaction with
46
+ * @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
47
+ * @returns a hex string of the encoded transaction
48
+ */
49
+ declare function encodeForMultisigning(json: object, signer: string, definitions?: XrplDefinitionsBase): string;
50
+ /**
51
+ * Encode a quality value
52
+ *
53
+ * @param value string representation of a number
54
+ * @returns a hex-string representing the quality
55
+ */
56
+ declare function encodeQuality(value: string): string;
57
+ /**
58
+ * Decode a quality value
59
+ *
60
+ * @param value hex-string of a quality
61
+ * @returns a string representing the quality
62
+ */
63
+ declare function decodeQuality(value: string): string;
64
+ export { decode, encode, encodeForSigning, encodeForSigningClaim, encodeForMultisigning, encodeQuality, decodeQuality, decodeLedgerData, TRANSACTION_TYPES, XrplDefinitions, XrplDefinitionsBase, DEFAULT_DEFINITIONS, coreTypes, };