@transia/ripple-binary-codec 1.4.6-alpha.9 → 2.5.2-alpha.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 (363) hide show
  1. package/dist/binary.d.ts +30 -16
  2. package/dist/binary.js +36 -16
  3. package/dist/binary.js.map +1 -1
  4. package/dist/enums/bytes.d.ts +1 -2
  5. package/dist/enums/bytes.js +3 -2
  6. package/dist/enums/bytes.js.map +1 -1
  7. package/dist/enums/constants.d.ts +1 -0
  8. package/dist/enums/constants.js +6 -5
  9. package/dist/enums/constants.js.map +1 -1
  10. package/dist/enums/definitions.json +1604 -969
  11. package/dist/enums/field.d.ts +1 -2
  12. package/dist/enums/field.js +1 -2
  13. package/dist/enums/field.js.map +1 -1
  14. package/dist/enums/index.d.ts +1 -2
  15. package/dist/enums/index.js +5 -27
  16. package/dist/enums/index.js.map +1 -1
  17. package/dist/enums/src/enums/definitions.json +1606 -971
  18. package/dist/enums/xrpl-definitions-base.d.ts +5 -3
  19. package/dist/enums/xrpl-definitions-base.js +26 -6
  20. package/dist/enums/xrpl-definitions-base.js.map +1 -1
  21. package/dist/enums/xrpl-definitions.d.ts +2 -1
  22. package/dist/enums/xrpl-definitions.js +2 -1
  23. package/dist/enums/xrpl-definitions.js.map +1 -1
  24. package/dist/hash-prefixes.d.ts +1 -2
  25. package/dist/hash-prefixes.js +8 -6
  26. package/dist/hash-prefixes.js.map +1 -1
  27. package/dist/hashes.d.ts +6 -7
  28. package/dist/hashes.js +6 -7
  29. package/dist/hashes.js.map +1 -1
  30. package/dist/index.d.ts +16 -11
  31. package/dist/index.js +53 -58
  32. package/dist/index.js.map +1 -1
  33. package/dist/ledger-hashes.d.ts +1 -2
  34. package/dist/ledger-hashes.js +11 -30
  35. package/dist/ledger-hashes.js.map +1 -1
  36. package/dist/quality.d.ts +3 -4
  37. package/dist/quality.js +10 -8
  38. package/dist/quality.js.map +1 -1
  39. package/dist/serdes/binary-parser.d.ts +2 -3
  40. package/dist/serdes/binary-parser.js +16 -32
  41. package/dist/serdes/binary-parser.js.map +1 -1
  42. package/dist/serdes/binary-serializer.d.ts +7 -8
  43. package/dist/serdes/binary-serializer.js +14 -37
  44. package/dist/serdes/binary-serializer.js.map +1 -1
  45. package/dist/shamap.d.ts +4 -5
  46. package/dist/shamap.js +5 -5
  47. package/dist/shamap.js.map +1 -1
  48. package/dist/src/binary.d.ts +106 -0
  49. package/dist/src/binary.js +154 -0
  50. package/dist/src/binary.js.map +1 -0
  51. package/dist/src/coretypes.d.ts +9 -0
  52. package/dist/src/coretypes.js +48 -0
  53. package/dist/src/coretypes.js.map +1 -0
  54. package/dist/src/enums/bytes.d.ts +25 -0
  55. package/dist/src/enums/bytes.js +65 -0
  56. package/dist/src/enums/bytes.js.map +1 -0
  57. package/dist/src/enums/constants.d.ts +5 -0
  58. package/dist/src/enums/constants.js +9 -0
  59. package/dist/src/enums/constants.js.map +1 -0
  60. package/dist/src/enums/definitions.json +3404 -0
  61. package/dist/src/enums/field.d.ts +28 -0
  62. package/dist/src/enums/field.js +58 -0
  63. package/dist/src/enums/field.js.map +1 -0
  64. package/dist/src/enums/index.d.ts +12 -0
  65. package/dist/src/enums/index.js +31 -0
  66. package/dist/src/enums/index.js.map +1 -0
  67. package/dist/src/enums/utils-renumber.d.ts +101 -0
  68. package/dist/src/enums/utils-renumber.js +127 -0
  69. package/dist/src/enums/utils-renumber.js.map +1 -0
  70. package/dist/src/enums/xrpl-definitions-base.d.ts +47 -0
  71. package/dist/src/enums/xrpl-definitions-base.js +83 -0
  72. package/dist/src/enums/xrpl-definitions-base.js.map +1 -0
  73. package/dist/src/enums/xrpl-definitions.d.ts +22 -0
  74. package/dist/src/enums/xrpl-definitions.js +30 -0
  75. package/dist/src/enums/xrpl-definitions.js.map +1 -0
  76. package/dist/src/hash-prefixes.d.ts +5 -0
  77. package/dist/src/hash-prefixes.js +43 -0
  78. package/dist/src/hash-prefixes.js.map +1 -0
  79. package/dist/src/hashes.d.ts +50 -0
  80. package/dist/src/hashes.js +76 -0
  81. package/dist/src/hashes.js.map +1 -0
  82. package/dist/src/index.d.ts +69 -0
  83. package/dist/src/index.js +134 -0
  84. package/dist/src/index.js.map +1 -0
  85. package/dist/src/ledger-hashes.d.ts +48 -0
  86. package/dist/src/ledger-hashes.js +141 -0
  87. package/dist/src/ledger-hashes.js.map +1 -0
  88. package/dist/src/quality.d.ts +21 -0
  89. package/dist/src/quality.js +42 -0
  90. package/dist/src/quality.js.map +1 -0
  91. package/dist/src/serdes/binary-parser.d.ts +100 -0
  92. package/dist/src/serdes/binary-parser.js +194 -0
  93. package/dist/src/serdes/binary-parser.js.map +1 -0
  94. package/dist/src/serdes/binary-serializer.d.ts +81 -0
  95. package/dist/src/serdes/binary-serializer.js +149 -0
  96. package/dist/src/serdes/binary-serializer.js.map +1 -0
  97. package/dist/src/shamap.d.ts +102 -0
  98. package/dist/src/shamap.js +172 -0
  99. package/dist/src/shamap.js.map +1 -0
  100. package/dist/src/types/account-id.d.ts +37 -0
  101. package/dist/src/types/account-id.js +73 -0
  102. package/dist/src/types/account-id.js.map +1 -0
  103. package/dist/src/types/amount.d.ts +92 -0
  104. package/dist/src/types/amount.js +292 -0
  105. package/dist/src/types/amount.js.map +1 -0
  106. package/dist/src/types/blob.d.ts +25 -0
  107. package/dist/src/types/blob.js +46 -0
  108. package/dist/src/types/blob.js.map +1 -0
  109. package/dist/src/types/currency.d.ts +30 -0
  110. package/dist/src/types/currency.js +131 -0
  111. package/dist/src/types/currency.js.map +1 -0
  112. package/dist/src/types/data.d.ts +104 -0
  113. package/dist/src/types/data.js +387 -0
  114. package/dist/src/types/data.js.map +1 -0
  115. package/dist/src/types/dataType.d.ts +94 -0
  116. package/dist/src/types/dataType.js +145 -0
  117. package/dist/src/types/dataType.js.map +1 -0
  118. package/dist/src/types/hash-128.d.ts +18 -0
  119. package/dist/src/types/hash-128.js +36 -0
  120. package/dist/src/types/hash-128.js.map +1 -0
  121. package/dist/src/types/hash-160.d.ts +12 -0
  122. package/dist/src/types/hash-160.js +23 -0
  123. package/dist/src/types/hash-160.js.map +1 -0
  124. package/dist/src/types/hash-192.d.ts +12 -0
  125. package/dist/src/types/hash-192.js +23 -0
  126. package/dist/src/types/hash-192.js.map +1 -0
  127. package/dist/src/types/hash-256.d.ts +12 -0
  128. package/dist/src/types/hash-256.js +20 -0
  129. package/dist/src/types/hash-256.js.map +1 -0
  130. package/dist/src/types/hash.d.ts +40 -0
  131. package/dist/src/types/hash.js +76 -0
  132. package/dist/src/types/hash.js.map +1 -0
  133. package/dist/src/types/index.d.ts +21 -0
  134. package/dist/src/types/index.js +72 -0
  135. package/dist/src/types/index.js.map +1 -0
  136. package/dist/src/types/issue.d.ts +49 -0
  137. package/dist/src/types/issue.js +107 -0
  138. package/dist/src/types/issue.js.map +1 -0
  139. package/dist/src/types/json.d.ts +169 -0
  140. package/dist/src/types/json.js +529 -0
  141. package/dist/src/types/json.js.map +1 -0
  142. package/dist/src/types/path-set.d.ts +37 -0
  143. package/dist/src/types/path-set.js +236 -0
  144. package/dist/src/types/path-set.js.map +1 -0
  145. package/dist/src/types/serialized-type.d.ts +117 -0
  146. package/dist/src/types/serialized-type.js +242 -0
  147. package/dist/src/types/serialized-type.js.map +1 -0
  148. package/dist/src/types/st-array.d.ts +32 -0
  149. package/dist/src/types/st-array.js +89 -0
  150. package/dist/src/types/st-array.js.map +1 -0
  151. package/dist/src/types/st-number.d.ts +55 -0
  152. package/dist/src/types/st-number.js +212 -0
  153. package/dist/src/types/st-number.js.map +1 -0
  154. package/dist/src/types/st-object.d.ts +33 -0
  155. package/dist/src/types/st-object.js +176 -0
  156. package/dist/src/types/st-object.js.map +1 -0
  157. package/dist/src/types/uint-16.d.ts +26 -0
  158. package/dist/src/types/uint-16.js +49 -0
  159. package/dist/src/types/uint-16.js.map +1 -0
  160. package/dist/src/types/uint-32.d.ts +26 -0
  161. package/dist/src/types/uint-32.js +54 -0
  162. package/dist/src/types/uint-32.js.map +1 -0
  163. package/dist/src/types/uint-64.d.ts +40 -0
  164. package/dist/src/types/uint-64.js +112 -0
  165. package/dist/src/types/uint-64.js.map +1 -0
  166. package/dist/src/types/uint-8.d.ts +26 -0
  167. package/dist/src/types/uint-8.js +50 -0
  168. package/dist/src/types/uint-8.js.map +1 -0
  169. package/dist/src/types/uint.d.ts +29 -0
  170. package/dist/src/types/uint.js +47 -0
  171. package/dist/src/types/uint.js.map +1 -0
  172. package/dist/src/types/vector-256.d.ts +31 -0
  173. package/dist/src/types/vector-256.js +76 -0
  174. package/dist/src/types/vector-256.js.map +1 -0
  175. package/dist/src/types/xchain-bridge.d.ts +45 -0
  176. package/dist/src/types/xchain-bridge.js +105 -0
  177. package/dist/src/types/xchain-bridge.js.map +1 -0
  178. package/dist/src/utils.d.ts +79 -0
  179. package/dist/src/utils.js +181 -0
  180. package/dist/src/utils.js.map +1 -0
  181. package/dist/tsconfig.tsbuildinfo +1 -0
  182. package/dist/types/account-id.d.ts +3 -2
  183. package/dist/types/account-id.js +8 -6
  184. package/dist/types/account-id.js.map +1 -1
  185. package/dist/types/amount.d.ts +33 -9
  186. package/dist/types/amount.js +128 -43
  187. package/dist/types/amount.js.map +1 -1
  188. package/dist/types/blob.d.ts +3 -3
  189. package/dist/types/blob.js +8 -2
  190. package/dist/types/blob.js.map +1 -1
  191. package/dist/types/currency.d.ts +3 -2
  192. package/dist/types/currency.js +17 -13
  193. package/dist/types/currency.js.map +1 -1
  194. package/dist/types/data.d.ts +104 -0
  195. package/dist/types/data.js +387 -0
  196. package/dist/types/data.js.map +1 -0
  197. package/dist/types/dataType.d.ts +94 -0
  198. package/dist/types/dataType.js +145 -0
  199. package/dist/types/dataType.js.map +1 -0
  200. package/dist/types/hash-128.d.ts +3 -2
  201. package/dist/types/hash-128.js +7 -3
  202. package/dist/types/hash-128.js.map +1 -1
  203. package/dist/types/hash-160.d.ts +3 -2
  204. package/dist/types/hash-160.js +5 -2
  205. package/dist/types/hash-160.js.map +1 -1
  206. package/dist/types/hash-192.d.ts +12 -0
  207. package/dist/types/hash-192.js +23 -0
  208. package/dist/types/hash-192.js.map +1 -0
  209. package/dist/types/hash-256.d.ts +3 -2
  210. package/dist/types/hash-256.js +5 -2
  211. package/dist/types/hash-256.js.map +1 -1
  212. package/dist/types/hash.d.ts +2 -3
  213. package/dist/types/hash.js +8 -4
  214. package/dist/types/hash.js.map +1 -1
  215. package/dist/types/index.d.ts +4 -1
  216. package/dist/types/index.js +17 -2
  217. package/dist/types/index.js.map +1 -1
  218. package/dist/types/issue.d.ts +49 -0
  219. package/dist/types/issue.js +107 -0
  220. package/dist/types/issue.js.map +1 -0
  221. package/dist/types/json.d.ts +169 -0
  222. package/dist/types/json.js +529 -0
  223. package/dist/types/json.js.map +1 -0
  224. package/dist/types/path-set.d.ts +2 -1
  225. package/dist/types/path-set.js +15 -12
  226. package/dist/types/path-set.js.map +1 -1
  227. package/dist/types/serialized-type.d.ts +70 -16
  228. package/dist/types/serialized-type.js +153 -8
  229. package/dist/types/serialized-type.js.map +1 -1
  230. package/dist/types/st-array.d.ts +7 -3
  231. package/dist/types/st-array.js +20 -11
  232. package/dist/types/st-array.js.map +1 -1
  233. package/dist/types/st-number.d.ts +55 -0
  234. package/dist/types/st-number.js +212 -0
  235. package/dist/types/st-number.js.map +1 -0
  236. package/dist/types/st-object.d.ts +2 -1
  237. package/dist/types/st-object.js +35 -8
  238. package/dist/types/st-object.js.map +1 -1
  239. package/dist/types/uint-16.d.ts +3 -2
  240. package/dist/types/uint-16.js +10 -5
  241. package/dist/types/uint-16.js.map +1 -1
  242. package/dist/types/uint-32.d.ts +3 -2
  243. package/dist/types/uint-32.js +11 -6
  244. package/dist/types/uint-32.js.map +1 -1
  245. package/dist/types/uint-64.d.ts +8 -7
  246. package/dist/types/uint-64.js +49 -24
  247. package/dist/types/uint-64.js.map +1 -1
  248. package/dist/types/uint-8.d.ts +3 -2
  249. package/dist/types/uint-8.js +11 -5
  250. package/dist/types/uint-8.js.map +1 -1
  251. package/dist/types/uint.d.ts +5 -6
  252. package/dist/types/uint.js +5 -0
  253. package/dist/types/uint.js.map +1 -1
  254. package/dist/types/vector-256.d.ts +3 -3
  255. package/dist/types/vector-256.js +5 -4
  256. package/dist/types/vector-256.js.map +1 -1
  257. package/dist/types/xchain-bridge.d.ts +45 -0
  258. package/dist/types/xchain-bridge.js +105 -0
  259. package/dist/types/xchain-bridge.js.map +1 -0
  260. package/dist/utils.d.ts +79 -0
  261. package/dist/utils.js +181 -0
  262. package/dist/utils.js.map +1 -0
  263. package/package.json +21 -17
  264. package/src/README.md +5 -0
  265. package/src/binary.ts +235 -0
  266. package/src/coretypes.ts +31 -0
  267. package/src/enums/README.md +144 -0
  268. package/src/enums/bytes.ts +80 -0
  269. package/src/enums/constants.ts +5 -0
  270. package/src/enums/definitions.json +3409 -0
  271. package/src/enums/field.ts +84 -0
  272. package/src/enums/index.ts +34 -0
  273. package/src/enums/utils-renumber.ts +134 -0
  274. package/src/enums/xrpl-definitions-base.ts +150 -0
  275. package/src/enums/xrpl-definitions.ts +33 -0
  276. package/src/hash-prefixes.ts +42 -0
  277. package/src/hashes.ts +75 -0
  278. package/src/index.ts +166 -0
  279. package/src/ledger-hashes.ts +191 -0
  280. package/src/quality.ts +38 -0
  281. package/src/serdes/binary-parser.ts +228 -0
  282. package/src/serdes/binary-serializer.ts +166 -0
  283. package/src/shamap.ts +189 -0
  284. package/src/types/account-id.ts +91 -0
  285. package/src/types/amount.ts +366 -0
  286. package/src/types/blob.ts +50 -0
  287. package/src/types/currency.ts +145 -0
  288. package/src/types/data.ts +496 -0
  289. package/src/types/dataType.ts +178 -0
  290. package/src/types/hash-128.ts +38 -0
  291. package/src/types/hash-160.ts +24 -0
  292. package/src/types/hash-192.ts +24 -0
  293. package/src/types/hash-256.ts +20 -0
  294. package/src/types/hash.ts +86 -0
  295. package/src/types/index.ts +74 -0
  296. package/src/types/issue.ts +140 -0
  297. package/src/types/json.ts +641 -0
  298. package/src/types/path-set.ts +294 -0
  299. package/src/types/serialized-type.ts +271 -0
  300. package/src/types/st-array.ts +117 -0
  301. package/src/types/st-number.ts +238 -0
  302. package/src/types/st-object.ts +219 -0
  303. package/src/types/uint-16.ts +58 -0
  304. package/src/types/uint-32.ts +64 -0
  305. package/src/types/uint-64.ts +141 -0
  306. package/src/types/uint-8.ts +57 -0
  307. package/src/types/uint.ts +60 -0
  308. package/src/types/vector-256.ts +83 -0
  309. package/src/types/xchain-bridge.ts +132 -0
  310. package/src/utils.ts +220 -0
  311. package/test/amount.test.js +0 -43
  312. package/test/binary-json.test.js +0 -45
  313. package/test/binary-parser.test.js +0 -396
  314. package/test/binary-serializer.test.js +0 -319
  315. package/test/definitions.test.js +0 -100
  316. package/test/fixtures/account-tx-transactions.db +0 -0
  317. package/test/fixtures/codec-fixtures.json +0 -4466
  318. package/test/fixtures/data-driven-tests.json +0 -2919
  319. package/test/fixtures/delivermin-tx-binary.json +0 -1
  320. package/test/fixtures/delivermin-tx.json +0 -98
  321. package/test/fixtures/deposit-preauth-tx-binary.json +0 -1
  322. package/test/fixtures/deposit-preauth-tx-meta-binary.json +0 -1
  323. package/test/fixtures/deposit-preauth-tx.json +0 -58
  324. package/test/fixtures/escrow-cancel-binary.json +0 -1
  325. package/test/fixtures/escrow-cancel-tx.json +0 -6
  326. package/test/fixtures/escrow-create-binary.json +0 -1
  327. package/test/fixtures/escrow-create-tx.json +0 -10
  328. package/test/fixtures/escrow-finish-binary.json +0 -1
  329. package/test/fixtures/escrow-finish-meta-binary.json +0 -1
  330. package/test/fixtures/escrow-finish-tx.json +0 -95
  331. package/test/fixtures/ledger-full-38129.json +0 -1
  332. package/test/fixtures/ledger-full-40000.json +0 -1
  333. package/test/fixtures/negative-unl.json +0 -12
  334. package/test/fixtures/nf-token.json +0 -547
  335. package/test/fixtures/payment-channel-claim-binary.json +0 -1
  336. package/test/fixtures/payment-channel-claim-tx.json +0 -8
  337. package/test/fixtures/payment-channel-create-binary.json +0 -1
  338. package/test/fixtures/payment-channel-create-tx.json +0 -11
  339. package/test/fixtures/payment-channel-fund-binary.json +0 -1
  340. package/test/fixtures/payment-channel-fund-tx.json +0 -7
  341. package/test/fixtures/remit-binary.json +0 -1
  342. package/test/fixtures/remit-tx.json +0 -39
  343. package/test/fixtures/signerlistset-tx-binary.json +0 -1
  344. package/test/fixtures/signerlistset-tx-meta-binary.json +0 -1
  345. package/test/fixtures/signerlistset-tx.json +0 -94
  346. package/test/fixtures/ticket-create-binary.json +0 -1
  347. package/test/fixtures/ticket-create-tx.json +0 -7
  348. package/test/fixtures/unl-report-binary.json +0 -1
  349. package/test/fixtures/unl-report-meta-binary.json +0 -1
  350. package/test/fixtures/unl-report.json +0 -89
  351. package/test/fixtures/x-codec-fixtures.json +0 -188
  352. package/test/hash.test.js +0 -135
  353. package/test/ledger.test.js +0 -29
  354. package/test/lower-case-hex.test.js +0 -46
  355. package/test/pseudo-transaction.test.js +0 -38
  356. package/test/quality.test.js +0 -15
  357. package/test/shamap.test.js +0 -89
  358. package/test/signing-data-encoding.test.js +0 -213
  359. package/test/tx-encode-decode.test.js +0 -119
  360. package/test/types.test.js +0 -34
  361. package/test/uint.test.js +0 -148
  362. package/test/utils.js +0 -30
  363. package/test/x-address.test.js +0 -181
@@ -1,94 +0,0 @@
1
- {
2
- "Account": "rfCp6hiUS4qqN1i4hTyX4ogA49MEbXgCau",
3
- "Fee": "11",
4
- "Flags": 2147483648,
5
- "LastLedgerSequence": 24268341,
6
- "Sequence": 15177,
7
- "SignerEntries": [
8
- {
9
- "SignerEntry": {
10
- "Account": "r4PQv7BCpp4SAJx3isNpQM8T2BuGrMQs5U",
11
- "SignerWeight": 1
12
- }
13
- },
14
- {
15
- "SignerEntry": {
16
- "Account": "rH7KDR67MZR7LDV7gesmEMXtaqU3FaK7Lr",
17
- "SignerWeight": 1
18
- }
19
- },
20
- {
21
- "SignerEntry": {
22
- "Account": "rPqHsX34XApKSfE4UxKbqVXb3WRmmgMY2u",
23
- "SignerWeight": 1
24
- }
25
- }
26
- ],
27
- "SignerQuorum": 3,
28
- "SigningPubKey": "0315B15964B3704B171E860DE1FC914D283395EE825C8546AEEBF0D24A5802BBC5",
29
- "TransactionType": "SignerListSet",
30
- "TxnSignature": "3044022069FC98D0BC32F510D4F94ECC726613E957D290050E428DD86EDA2C2515A1732D02207064EF085437B3F12A744AC6528D9E0C59FAA5A9FE903DF3639D2F09B522175F",
31
- "date": 527847001,
32
- "hash": "98C33CABFAE9F830CE842C260E34C25B0F987EE691941C0C9225AD476871B73D",
33
- "inLedger": 24268339,
34
- "ledger_index": 24268339,
35
- "meta": {
36
- "AffectedNodes": [
37
- {
38
- "ModifiedNode": {
39
- "FinalFields": {
40
- "Account": "rfCp6hiUS4qqN1i4hTyX4ogA49MEbXgCau",
41
- "Balance": "4556673359",
42
- "Flags": 0,
43
- "OwnerCount": 25,
44
- "RegularKey": "rK7ShY9CeDMBHLNFSMtTrSAUd9uzwcymcL",
45
- "Sequence": 15178
46
- },
47
- "LedgerEntryType": "AccountRoot",
48
- "LedgerIndex": "0DAF42BEE40F0EEFCFD8D54E81ECACD9371D281CDD9B77384FCDAF0E16560A44",
49
- "PreviousFields": {
50
- "Balance": "4556673370",
51
- "Sequence": 15177
52
- },
53
- "PreviousTxnID": "4CD30C2526418A76ABED74713DF144B19F1B29BD8F7BC9EADCF16D33D7EC83D8",
54
- "PreviousTxnLgrSeq": 24265571
55
- }
56
- },
57
- {
58
- "ModifiedNode": {
59
- "FinalFields": {
60
- "Flags": 0,
61
- "OwnerNode": "0000000000000000",
62
- "SignerEntries": [
63
- {
64
- "SignerEntry": {
65
- "Account": "rH7KDR67MZR7LDV7gesmEMXtaqU3FaK7Lr",
66
- "SignerWeight": 1
67
- }
68
- },
69
- {
70
- "SignerEntry": {
71
- "Account": "r4PQv7BCpp4SAJx3isNpQM8T2BuGrMQs5U",
72
- "SignerWeight": 1
73
- }
74
- },
75
- {
76
- "SignerEntry": {
77
- "Account": "rPqHsX34XApKSfE4UxKbqVXb3WRmmgMY2u",
78
- "SignerWeight": 1
79
- }
80
- }
81
- ],
82
- "SignerListID": 0,
83
- "SignerQuorum": 3
84
- },
85
- "LedgerEntryType": "SignerList",
86
- "LedgerIndex": "16F6AEEC6B85C9658B4BF604671677B7A7B2FAAFDB2FA5A0B72CBB49CAE80924"
87
- }
88
- }
89
- ],
90
- "TransactionIndex": 8,
91
- "TransactionResult": "tesSUCCESS"
92
- },
93
- "validated": true
94
- }
@@ -1 +0,0 @@
1
- "12000A240000000E2028000000016840000000000027108114D5024F157225CA9F8F4C73094D61A8FDD746E0DB"
@@ -1,7 +0,0 @@
1
- {
2
- "TransactionType": "TicketCreate",
3
- "TicketCount": 1,
4
- "Account": "rLRH6HciuPv5rQBNFBYH1iPPAuVFERtNXZ",
5
- "Sequence": 14,
6
- "Fee": "10000"
7
- }
@@ -1 +0,0 @@
1
- "120068240000000026006D2E00684000000000000000730081140000000000000000000000000000000000000000E05F7121ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655E1"
@@ -1 +0,0 @@
1
- "201C00000000F8E51100525661E32E7A24A238F1C619D5F9DDCC41A94B33B66C0163F7EFCC8A19C9FD6F28DCE6F05FE05F7121ED3ABC6740983BFB13FFD9728EBCC365A2877877D368FC28990819522300C92A698114A53F8465478D79DC0C764F0FB2B67AE92465FD5EE1E05F7121ED49F82B2FFD537F224A1E0A10DEEFC3C25CE3882979E6B327C9F18603D21F0A2281142BF2A77E25382EC1DEF521D81D24BC0FDD35BC9BE1E05F7121ED79EB0F6A9F01A039235E536D19F812B55ACF540C9E22CF62C271E0D42BFF51748114C45147960400DB6B763110CBCE8D641E9365F24EE1E05F7121ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655811408BCFB092DEE1BF0F2662AECE4DCC62C4AECCB8AE1E05F7121ED96F581FED430E8CBE1F08B37408857001D4118D49FBB594B0BE007C2DBFFD3678114A4EF485B50A7D91DF45450A680FAC31C53367B2DE1E05F7121EDCF31B8F683345E1C49B4A1D85BF2731E55E7D6781F3D4BF45EE7ADF2D2FB340281144D854497B48F1A41EF04E09DB656A11AAD01A703E1E05F7121EDDF197FC59A7FAA09EB1AD60A4638BA6201DD51497B5C08A1745115098E229E0E811446550CBD2B655081662AE3159B0488DE27EC0592E1F1E1E72200000000F05EE05E7121ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860811478339DD5880A994A5CB6E56CB7ED13FEEF201928E1F1F05FE05F7121ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655811408BCFB092DEE1BF0F2662AECE4DCC62C4AECCB8AE1F1E1E1F1031000"
@@ -1,89 +0,0 @@
1
- {
2
- "Account": "",
3
- "ActiveValidator": {
4
- "PublicKey": "ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655"
5
- },
6
- "Fee": "0",
7
- "LedgerSequence": 7155200,
8
- "Sequence": 0,
9
- "SigningPubKey": "",
10
- "TransactionType": "UNLReport",
11
- "hash": "0878863F758F74A5CBD35691CDAB625A3BCD35B21B440E20545C4757DDB0CA43",
12
- "meta": {
13
- "AffectedNodes": [
14
- {
15
- "ModifiedNode": {
16
- "FinalFields": {
17
- "ActiveValidators": [
18
- {
19
- "ActiveValidator": {
20
- "Account": "roUo3ygV92bdhfE1v9LGpPETXvJv2kQv5",
21
- "PublicKey": "ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655"
22
- }
23
- }
24
- ],
25
- "Flags": 0,
26
- "ImportVLKeys": [
27
- {
28
- "ImportVLKey": {
29
- "Account": "rBxZvQBY551DJ21g9AC1Qc9ASQowqcskbF",
30
- "PublicKey": "ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860"
31
- }
32
- }
33
- ]
34
- },
35
- "LedgerEntryType": "UNLReport",
36
- "LedgerIndex": "61E32E7A24A238F1C619D5F9DDCC41A94B33B66C0163F7EFCC8A19C9FD6F28DC",
37
- "PreviousFields": {
38
- "ActiveValidators": [
39
- {
40
- "ActiveValidator": {
41
- "Account": "rGhk2uLd8ShzX2Zrcgn8sQk1LWBG4jjEwf",
42
- "PublicKey": "ED3ABC6740983BFB13FFD9728EBCC365A2877877D368FC28990819522300C92A69"
43
- }
44
- },
45
- {
46
- "ActiveValidator": {
47
- "Account": "rnr4kwS1VkJhvjVRuq2fbWZtEdN2HbpVVu",
48
- "PublicKey": "ED49F82B2FFD537F224A1E0A10DEEFC3C25CE3882979E6B327C9F18603D21F0A22"
49
- }
50
- },
51
- {
52
- "ActiveValidator": {
53
- "Account": "rJupFrPPYgUNFBdoSqhMEJ22hiHKiZSHXQ",
54
- "PublicKey": "ED79EB0F6A9F01A039235E536D19F812B55ACF540C9E22CF62C271E0D42BFF5174"
55
- }
56
- },
57
- {
58
- "ActiveValidator": {
59
- "Account": "roUo3ygV92bdhfE1v9LGpPETXvJv2kQv5",
60
- "PublicKey": "ED93B2BE467CAD2F9F56FB3A82BDFF17F84B09E34232DDE8FAF2FC72382F142655"
61
- }
62
- },
63
- {
64
- "ActiveValidator": {
65
- "Account": "rGsa7f4arJ8JE9ok9LCht6jCu5xBKUKVMq",
66
- "PublicKey": "ED96F581FED430E8CBE1F08B37408857001D4118D49FBB594B0BE007C2DBFFD367"
67
- }
68
- },
69
- {
70
- "ActiveValidator": {
71
- "Account": "r3htgPchiR2r8kMGzPK3Wfv3WTrpaRKjtU",
72
- "PublicKey": "EDCF31B8F683345E1C49B4A1D85BF2731E55E7D6781F3D4BF45EE7ADF2D2FB3402"
73
- }
74
- },
75
- {
76
- "ActiveValidator": {
77
- "Account": "rfQtB8m51sdbWgcmddRX2mMjMpSxzX1AGr",
78
- "PublicKey": "EDDF197FC59A7FAA09EB1AD60A4638BA6201DD51497B5C08A1745115098E229E0E"
79
- }
80
- }
81
- ]
82
- }
83
- }
84
- }
85
- ],
86
- "TransactionIndex": 0,
87
- "TransactionResult": "tesSUCCESS"
88
- }
89
- }
@@ -1,188 +0,0 @@
1
- {
2
- "transactions": [{
3
- "rjson": {
4
- "Account": "r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV",
5
- "Destination": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
6
- "TransactionType": "Payment",
7
- "TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
8
- "SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
9
- "Amount": "10000000000",
10
- "DestinationTag": 1010,
11
- "SourceTag": 84854,
12
- "Fee": "10",
13
- "Flags": 0,
14
- "Sequence": 62
15
- },
16
- "xjson": {
17
- "Account": "X7tFPvjMH7nDxP8nTGkeeggcUpCZj8UbyT2QoiRHGDfjqrB",
18
- "Destination": "XVYmGpJqHS95ir411XvanwY1xt5Z2314WsamHPVgUNABUGV",
19
- "TransactionType": "Payment",
20
- "TxnSignature": "3045022022EB32AECEF7C644C891C19F87966DF9C62B1F34BABA6BE774325E4BB8E2DD62022100A51437898C28C2B297112DF8131F2BB39EA5FE613487DDD611525F1796264639",
21
- "SigningPubKey": "034AADB09CFF4A4804073701EC53C3510CDC95917C2BB0150FB742D0C66E6CEE9E",
22
- "Amount": "10000000000",
23
- "Fee": "10",
24
- "Flags": 0,
25
- "Sequence": 62
26
- }
27
- },
28
- {
29
- "rjson": {
30
- "Account": "r4DymtkgUAh2wqRxVfdd3Xtswzim6eC6c5",
31
- "Amount": "199000000",
32
- "Destination": "rsekGH9p9neiPxym2TMJhqaCzHFuokenTU",
33
- "DestinationTag": 3663729509,
34
- "Fee": "6335",
35
- "Flags": 2147483648,
36
- "LastLedgerSequence": 57313352,
37
- "Sequence": 105791,
38
- "SigningPubKey": "02053A627976CE1157461336AC65290EC1571CAAD1B327339980F7BF65EF776F83",
39
- "TransactionType": "Payment",
40
- "TxnSignature": "30440220086D3330CD6CE01D891A26BA0355D8D5A5D28A5C9A1D0C5E06E321C81A02318A0220027C3F6606E41FEA35103EDE5224CC489B6514ACFE27543185B0419DD02E301C"
41
- },
42
- "xjson": {
43
- "Account": "r4DymtkgUAh2wqRxVfdd3Xtswzim6eC6c5",
44
- "Amount": "199000000",
45
- "Destination": "X7cBoj6a5xSEfPCr6AStN9YPhbMAA2yaN2XYWwRJKAKb3y5",
46
- "Fee": "6335",
47
- "Flags": 2147483648,
48
- "LastLedgerSequence": 57313352,
49
- "Sequence": 105791,
50
- "SigningPubKey": "02053A627976CE1157461336AC65290EC1571CAAD1B327339980F7BF65EF776F83",
51
- "TransactionType": "Payment",
52
- "TxnSignature": "30440220086D3330CD6CE01D891A26BA0355D8D5A5D28A5C9A1D0C5E06E321C81A02318A0220027C3F6606E41FEA35103EDE5224CC489B6514ACFE27543185B0419DD02E301C"
53
- }
54
- },
55
- {
56
- "rjson": {
57
- "Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
58
- "Amount": "105302107",
59
- "Destination": "r33hypJXDs47LVpmvta7hMW9pR8DYeBtkW",
60
- "DestinationTag": 1658156118,
61
- "Fee": "60000",
62
- "Flags": 2147483648,
63
- "LastLedgerSequence": 57313566,
64
- "Sequence": 1113196,
65
- "SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
66
- "TransactionType": "Payment",
67
- "TxnSignature": "3045022100FCA10FBAC65EA60C115A970CD52E6A526B1F9DDB6C4F843DA3DE7A97DFF9492D022037824D0FC6F663FB08BE0F2812CBADE1F61836528D44945FC37F10CC03215111"
68
- },
69
- "xjson": {
70
- "Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
71
- "Amount": "105302107",
72
- "Destination": "X7ikFY5asEwp6ikt2AJdTfBLALEs5JN35kkeqKVeT1GdvY1",
73
- "Fee": "60000",
74
- "Flags": 2147483648,
75
- "LastLedgerSequence": 57313566,
76
- "Sequence": 1113196,
77
- "SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
78
- "TransactionType": "Payment",
79
- "TxnSignature": "3045022100FCA10FBAC65EA60C115A970CD52E6A526B1F9DDB6C4F843DA3DE7A97DFF9492D022037824D0FC6F663FB08BE0F2812CBADE1F61836528D44945FC37F10CC03215111"
80
- }
81
- },
82
- {
83
- "rjson": {
84
- "Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
85
- "Amount": "3899911571",
86
- "Destination": "rU2mEJSLqBRkYLVTv55rFTgQajkLTnT6mA",
87
- "DestinationTag": 255406,
88
- "Fee": "60000",
89
- "Flags": 2147483648,
90
- "LastLedgerSequence": 57313566,
91
- "Sequence": 1113197,
92
- "SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
93
- "TransactionType": "Payment",
94
- "TxnSignature": "3044022077642D94BB3C49BF3CB4C804255EC830D2C6009EA4995E38A84602D579B8AAD702206FAD977C49980226E8B495BF03C8D9767380F1546BBF5A4FD47D604C0D2CCF9B"
95
- },
96
- "xjson": {
97
- "Account": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
98
- "Amount": "3899911571",
99
- "Destination": "XVfH8gwNWVbB5Kft16jmTNgGTqgw1dzA8ZTBkNjSLw6JdXS",
100
- "Fee": "60000",
101
- "Flags": 2147483648,
102
- "LastLedgerSequence": 57313566,
103
- "Sequence": 1113197,
104
- "SigningPubKey": "03D847C2DBED3ABF0453F71DCD7641989136277218DF516AD49519C9693F32727E",
105
- "TransactionType": "Payment",
106
- "TxnSignature": "3044022077642D94BB3C49BF3CB4C804255EC830D2C6009EA4995E38A84602D579B8AAD702206FAD977C49980226E8B495BF03C8D9767380F1546BBF5A4FD47D604C0D2CCF9B"
107
- }
108
- },
109
- {
110
- "rjson": {
111
- "Account": "r4eEbLKZGbVSBHnSUBZW8i5XaMjGLdqT4a",
112
- "Amount": "820370849",
113
- "Destination": "rDhmyBh4JwDAtXyRZDarNgg52UcLLRoGje",
114
- "DestinationTag": 2017780486,
115
- "Fee": "6000",
116
- "Flags": 2147483648,
117
- "LastLedgerSequence": 57315579,
118
- "Sequence": 234254,
119
- "SigningPubKey": "038CF47114672A12B269AEE015BF7A8438609B994B0640E4B28B2F56E93D948B15",
120
- "TransactionType": "Payment",
121
- "TxnSignature": "3044022015004653B1CBDD5CCA1F7B38555F1B37FE3F811E9D5070281CCC6C8A93460D870220679E9899184901EA69750C8A9325768490B1B9C1A733842446727653FF3D1DC0"
122
- },
123
- "xjson": {
124
- "Account": "r4eEbLKZGbVSBHnSUBZW8i5XaMjGLdqT4a",
125
- "Amount": "820370849",
126
- "Destination": "XV31huWNJQXsAJFwgE6rnC8uf8jRx4H4waq4MyGUxz5CXzS",
127
- "Fee": "6000",
128
- "Flags": 2147483648,
129
- "LastLedgerSequence": 57315579,
130
- "Sequence": 234254,
131
- "SigningPubKey": "038CF47114672A12B269AEE015BF7A8438609B994B0640E4B28B2F56E93D948B15",
132
- "TransactionType": "Payment",
133
- "TxnSignature": "3044022015004653B1CBDD5CCA1F7B38555F1B37FE3F811E9D5070281CCC6C8A93460D870220679E9899184901EA69750C8A9325768490B1B9C1A733842446727653FF3D1DC0"
134
- }
135
- },
136
- {
137
- "rjson": {
138
- "Account": "rsGeDwS4rpocUumu9smpXomzaaeG4Qyifz",
139
- "Amount": "1500000000",
140
- "Destination": "rDxfhNRgCDNDckm45zT5ayhKDC4Ljm7UoP",
141
- "DestinationTag": 1000635172,
142
- "Fee": "5000",
143
- "Flags": 2147483648,
144
- "Sequence": 55741075,
145
- "SigningPubKey": "02ECB814477DF9D8351918878E235EE6AF147A2A5C20F1E71F291F0F3303357C36",
146
- "SourceTag": 1000635172,
147
- "TransactionType": "Payment",
148
- "TxnSignature": "304402202A90972E21823214733082E1977F9EA2D6B5101902F108E7BDD7D128CEEA7AF3022008852C8DAD746A7F18E66A47414FABF551493674783E8EA7409C501D3F05F99A"
149
- },
150
- "xjson": {
151
- "Account": "rsGeDwS4rpocUumu9smpXomzaaeG4Qyifz",
152
- "Amount": "1500000000",
153
- "Destination": "XVBkK1yLutMqFGwTm6hykn7YXGDUrjsZSkpzMgRveZrMbHs",
154
- "Fee": "5000",
155
- "Flags": 2147483648,
156
- "Sequence": 55741075,
157
- "SigningPubKey": "02ECB814477DF9D8351918878E235EE6AF147A2A5C20F1E71F291F0F3303357C36",
158
- "SourceTag": 1000635172,
159
- "TransactionType": "Payment",
160
- "TxnSignature": "304402202A90972E21823214733082E1977F9EA2D6B5101902F108E7BDD7D128CEEA7AF3022008852C8DAD746A7F18E66A47414FABF551493674783E8EA7409C501D3F05F99A"
161
- }
162
- },
163
- {
164
- "rjson": {
165
- "Account": "rHWcuuZoFvDS6gNbmHSdpb7u1hZzxvCoMt",
166
- "Amount": "48918500000",
167
- "Destination": "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh",
168
- "DestinationTag": 105959914,
169
- "Fee": "10",
170
- "Flags": 2147483648,
171
- "Sequence": 32641,
172
- "SigningPubKey": "02E98DA545CCCC5D14C82594EE9E6CCFCF5171108E2410B3E784183E1068D33429",
173
- "TransactionType": "Payment",
174
- "TxnSignature": "304502210091DCA7AF189CD9DC93BDE24DEAE87381FBF16789C43113EE312241D648982B2402201C6055FEFFF1F119640AAC0B32C4F37375B0A96033E0527A21C1366920D6A524"
175
- },
176
- "xjson": {
177
- "Account": "rHWcuuZoFvDS6gNbmHSdpb7u1hZzxvCoMt",
178
- "Amount": "48918500000",
179
- "Destination": "XVH3aqvbYGhRhrD1FYSzGooNuxdzbG3VR2fuM47oqbXxQr7",
180
- "Fee": "10",
181
- "Flags": 2147483648,
182
- "Sequence": 32641,
183
- "SigningPubKey": "02E98DA545CCCC5D14C82594EE9E6CCFCF5171108E2410B3E784183E1068D33429",
184
- "TransactionType": "Payment",
185
- "TxnSignature": "304502210091DCA7AF189CD9DC93BDE24DEAE87381FBF16789C43113EE312241D648982B2402201C6055FEFFF1F119640AAC0B32C4F37375B0A96033E0527A21C1366920D6A524"
186
- }
187
- }]
188
- }
package/test/hash.test.js DELETED
@@ -1,135 +0,0 @@
1
- const { coreTypes } = require('../src/types')
2
- const { Hash128, Hash160, Hash256, AccountID, Currency } = coreTypes
3
- const { Buffer } = require('buffer/')
4
-
5
- describe('Hash128', function () {
6
- test('has a static width member', function () {
7
- expect(Hash128.width).toBe(16)
8
- })
9
- test('can be unset', function () {
10
- const h1 = Hash128.from('')
11
- expect(h1.toJSON()).toBe('')
12
- })
13
- test('can be compared against another', function () {
14
- const h1 = Hash128.from('100000000000000000000000000000000')
15
- const h2 = Hash128.from('200000000000000000000000000000000')
16
- const h3 = Hash128.from('000000000000000000000000000000003')
17
- expect(h1.lt(h2)).toBe(true)
18
- expect(h3.lt(h2)).toBe(true)
19
- expect(h2.gt(h1)).toBe(true)
20
- expect(h1.gt(h3)).toBe(true)
21
- })
22
- test('throws when constructed from invalid hash length', () => {
23
- expect(() => Hash128.from('1000000000000000000000000000000')).toThrow(
24
- 'Invalid Hash length 15',
25
- )
26
- expect(() => Hash128.from('10000000000000000000000000000000000')).toThrow(
27
- 'Invalid Hash length 17',
28
- )
29
- })
30
- })
31
- describe('Hash160', function () {
32
- test('has a static width member', function () {
33
- expect(Hash160.width).toBe(20)
34
- })
35
- test('inherited by subclasses', function () {
36
- expect(AccountID.width).toBe(20)
37
- expect(Currency.width).toBe(20)
38
- })
39
- test('can be compared against another', function () {
40
- const h1 = Hash160.from('1000000000000000000000000000000000000000')
41
- const h2 = Hash160.from('2000000000000000000000000000000000000000')
42
- const h3 = Hash160.from('0000000000000000000000000000000000000003')
43
- expect(h1.lt(h2)).toBe(true)
44
- expect(h3.lt(h2)).toBe(true)
45
- })
46
- test('throws when constructed from invalid hash length', () => {
47
- expect(() =>
48
- Hash160.from('10000000000000000000000000000000000000'),
49
- ).toThrow('Invalid Hash length 19')
50
- expect(() =>
51
- Hash160.from('100000000000000000000000000000000000000000'),
52
- ).toThrow('Invalid Hash length 21')
53
- })
54
- })
55
-
56
- describe('Hash256', function () {
57
- test('has a static width member', function () {
58
- expect(Hash256.width).toBe(32)
59
- })
60
- test('has a ZERO_256 member', function () {
61
- expect(Hash256.ZERO_256.toJSON()).toBe(
62
- '0000000000000000000000000000000000000000000000000000000000000000',
63
- )
64
- })
65
- test('supports getting the nibblet values at given positions', function () {
66
- const h = Hash256.from(
67
- '1359BD0000000000000000000000000000000000000000000000000000000000',
68
- )
69
- expect(h.nibblet(0)).toBe(0x1)
70
- expect(h.nibblet(1)).toBe(0x3)
71
- expect(h.nibblet(2)).toBe(0x5)
72
- expect(h.nibblet(3)).toBe(0x9)
73
- expect(h.nibblet(4)).toBe(0x0b)
74
- expect(h.nibblet(5)).toBe(0xd)
75
- })
76
- })
77
-
78
- describe('Currency', function () {
79
- test('Decoding allows dodgy XRP without throwing', function () {
80
- const currencyCode = '0000000000000000000000005841480000000000'
81
- expect(Currency.from(currencyCode).toJSON()).toBe(currencyCode)
82
- })
83
- test('Currency code with lowercase letters decodes to ISO code', () => {
84
- expect(Currency.from('xRp').toJSON()).toBe('xRp')
85
- })
86
- test('Currency codes with symbols decodes to ISO code', () => {
87
- expect(Currency.from('x|p').toJSON()).toBe('x|p')
88
- })
89
- test('Currency code with non-standard symbols decodes to hex', () => {
90
- expect(Currency.from(':::').toJSON()).toBe(
91
- '0000000000000000000000003A3A3A0000000000',
92
- )
93
- })
94
- test('Currency codes can be exclusively standard symbols', () => {
95
- expect(Currency.from('![]').toJSON()).toBe('![]')
96
- })
97
- test('Currency codes with uppercase and 0-9 decode to ISO codes', () => {
98
- expect(Currency.from('X8P').toJSON()).toBe('X8P')
99
- expect(Currency.from('USD').toJSON()).toBe('USD')
100
- })
101
-
102
- test('Currency codes with no contiguous zeroes in first 96 type code & reserved bits', function () {
103
- expect(
104
- Currency.from('0000000023410000000000005852520000000000').iso(),
105
- ).toBe(null)
106
- })
107
-
108
- test('Currency codes with no contiguous zeroes in last 40 reserved bits', function () {
109
- expect(
110
- Currency.from('0000000000000000000000005852527570656500').iso(),
111
- ).toBe(null)
112
- })
113
-
114
- test('can be constructed from a Buffer', function () {
115
- const xrp = new Currency(Buffer.alloc(20))
116
- expect(xrp.iso()).toBe('XAH')
117
- })
118
- test('Can handle non-standard currency codes', () => {
119
- const currency = '015841551A748AD2C1F76FF6ECB0CCCD00000000'
120
- expect(Currency.from(currency).toJSON()).toBe(currency)
121
- })
122
-
123
- test('Can handle other non-standard currency codes', () => {
124
- const currency = '0000000000414C6F676F30330000000000000000'
125
- expect(Currency.from(currency).toJSON()).toBe(currency)
126
- })
127
-
128
- test('throws on invalid reprs', function () {
129
- expect(() => Currency.from(Buffer.alloc(19))).toThrow()
130
- expect(() => Currency.from(1)).toThrow()
131
- expect(() =>
132
- Currency.from('00000000000000000000000000000000000000m'),
133
- ).toThrow()
134
- })
135
- })
@@ -1,29 +0,0 @@
1
- const { loadFixture } = require('./utils')
2
- const {
3
- transactionTreeHash,
4
- ledgerHash,
5
- accountStateHash,
6
- } = require('../src/ledger-hashes')
7
-
8
- describe('Ledger Hashes', function () {
9
- function testFactory(ledgerFixture) {
10
- describe(`can calculate hashes for ${ledgerFixture}`, function () {
11
- const ledger = loadFixture(ledgerFixture)
12
- test('computes correct account state hash', function () {
13
- expect(accountStateHash(ledger.accountState).toHex()).toBe(
14
- ledger.account_hash,
15
- )
16
- })
17
- test('computes correct transaction tree hash', function () {
18
- expect(transactionTreeHash(ledger.transactions).toHex()).toBe(
19
- ledger.transaction_hash,
20
- )
21
- })
22
- test('computes correct ledger header hash', function () {
23
- expect(ledgerHash(ledger).toHex()).toBe(ledger.hash)
24
- })
25
- })
26
- }
27
- testFactory('ledger-full-40000.json')
28
- testFactory('ledger-full-38129.json')
29
- })
@@ -1,46 +0,0 @@
1
- const { encode, decode } = require('../src')
2
-
3
- let str =
4
- '1100612200000000240000000125000068652D0000000055B6632D6376A2D9319F20A1C6DCCB486432D1E4A79951229D4C3DE2946F51D56662400009184E72A00081140DD319918CD5AE792BF7EC80D63B0F01B4573BBC'
5
- let lower = str.toLowerCase()
6
-
7
- let bin =
8
- '1100612200000000240000000125000000082D00000000550735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E56240000002540BE400811479927BAFFD3D04A26096C0C97B1B0D45B01AD3C0'
9
- let json = {
10
- OwnerCount: 0,
11
- Account: 'rUnFEsHjxqTswbivzL2DNHBb34rhAgZZZK',
12
- PreviousTxnLgrSeq: 8,
13
- LedgerEntryType: 'AccountRoot',
14
- PreviousTxnID:
15
- '0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5'.toLowerCase(),
16
- Flags: 0,
17
- Sequence: 1,
18
- Balance: '10000000000',
19
- }
20
-
21
- let jsonUpper = {
22
- OwnerCount: 0,
23
- Account: 'rUnFEsHjxqTswbivzL2DNHBb34rhAgZZZK',
24
- PreviousTxnLgrSeq: 8,
25
- LedgerEntryType: 'AccountRoot',
26
- PreviousTxnID:
27
- '0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5',
28
- Flags: 0,
29
- Sequence: 1,
30
- Balance: '10000000000',
31
- }
32
-
33
- describe('Lowercase hex test', () => {
34
- test('Correctly decodes', () => {
35
- expect(decode(lower)).toEqual(decode(str))
36
- })
37
- test('Re-encodes to uppercase hex', () => {
38
- expect(encode(decode(lower))).toEqual(str)
39
- })
40
- test('Encode when hex field lowercase', () => {
41
- expect(encode(json)).toBe(bin)
42
- })
43
- test('Re-decodes to uppercase hex', () => {
44
- expect(decode(encode(json))).toEqual(jsonUpper)
45
- })
46
- })
@@ -1,38 +0,0 @@
1
- const { encode, decode } = require('../src')
2
-
3
- let json = {
4
- Account: 'rrrrrrrrrrrrrrrrrrrrrhoLvTp',
5
- Sequence: 0,
6
- Fee: '0',
7
- SigningPubKey: '',
8
- Signature: '',
9
- }
10
-
11
- let json_blank_acct = {
12
- Account: '',
13
- Sequence: 0,
14
- Fee: '0',
15
- SigningPubKey: '',
16
- Signature: '',
17
- }
18
-
19
- let binary =
20
- '24000000006840000000000000007300760081140000000000000000000000000000000000000000'
21
-
22
- describe('Can encode Pseudo Transactions', () => {
23
- test('Correctly encodes Pseudo Transaciton', () => {
24
- expect(encode(json)).toEqual(binary)
25
- })
26
-
27
- test('Can decode account objects', () => {
28
- expect(decode(encode(json))).toEqual(json)
29
- })
30
-
31
- test('Blank AccountID is ACCOUNT_ZERO', () => {
32
- expect(encode(json_blank_acct)).toEqual(binary)
33
- })
34
-
35
- test('Decodes Blank AccountID', () => {
36
- expect(decode(encode(json_blank_acct))).toEqual(json)
37
- })
38
- })
@@ -1,15 +0,0 @@
1
- const { quality } = require('../src/coretypes')
2
-
3
- describe('Quality encode/decode', function () {
4
- const bookDirectory =
5
- '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0'
6
- const expectedQuality = '195796912.5171664'
7
- test('can decode', function () {
8
- const decimal = quality.decode(bookDirectory)
9
- expect(decimal.toString()).toBe(expectedQuality)
10
- })
11
- test('can encode', function () {
12
- const bytes = quality.encode(expectedQuality)
13
- expect(bytes.toString('hex').toUpperCase()).toBe(bookDirectory.slice(-16))
14
- })
15
- })