ripple-binary-codec 1.0.2 → 1.0.3-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 (333) hide show
  1. package/README.md +3 -3
  2. package/dist/binary.d.ts +34 -20
  3. package/dist/binary.js +51 -34
  4. package/dist/binary.js.map +1 -1
  5. package/dist/coretypes.d.ts +9 -9
  6. package/dist/coretypes.js +33 -9
  7. package/dist/coretypes.js.map +1 -1
  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 +3066 -1760
  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 -46
  19. package/dist/enums/index.js +22 -110
  20. package/dist/enums/index.js.map +1 -1
  21. package/dist/enums/src/enums/definitions.json +3073 -0
  22. package/dist/enums/utils-renumber.js +20 -20
  23. package/dist/enums/utils-renumber.js.map +1 -1
  24. package/dist/enums/xrpl-definitions-base.d.ts +44 -0
  25. package/dist/enums/xrpl-definitions-base.js +59 -0
  26. package/dist/enums/xrpl-definitions-base.js.map +1 -0
  27. package/dist/enums/xrpl-definitions.d.ts +21 -0
  28. package/dist/enums/xrpl-definitions.js +29 -0
  29. package/dist/enums/xrpl-definitions.js.map +1 -0
  30. package/dist/hash-prefixes.d.ts +1 -2
  31. package/dist/hash-prefixes.js +7 -6
  32. package/dist/hash-prefixes.js.map +1 -1
  33. package/dist/hashes.d.ts +7 -8
  34. package/dist/hashes.js +23 -44
  35. package/dist/hashes.js.map +1 -1
  36. package/dist/index.d.ts +16 -17
  37. package/dist/index.js +65 -40
  38. package/dist/index.js.map +1 -1
  39. package/dist/ledger-hashes.d.ts +6 -3
  40. package/dist/ledger-hashes.js +40 -33
  41. package/dist/ledger-hashes.js.map +1 -1
  42. package/dist/quality.d.ts +3 -4
  43. package/dist/quality.js +20 -19
  44. package/dist/quality.js.map +1 -1
  45. package/dist/serdes/binary-parser.d.ts +8 -6
  46. package/dist/serdes/binary-parser.js +74 -64
  47. package/dist/serdes/binary-parser.js.map +1 -1
  48. package/dist/serdes/binary-serializer.d.ts +10 -11
  49. package/dist/serdes/binary-serializer.js +50 -48
  50. package/dist/serdes/binary-serializer.js.map +1 -1
  51. package/dist/shamap.d.ts +6 -7
  52. package/dist/shamap.js +74 -97
  53. package/dist/shamap.js.map +1 -1
  54. package/dist/src/binary.d.ts +90 -0
  55. package/dist/src/binary.js +128 -0
  56. package/dist/src/binary.js.map +1 -0
  57. package/dist/src/coretypes.d.ts +9 -0
  58. package/dist/src/coretypes.js +48 -0
  59. package/dist/src/coretypes.js.map +1 -0
  60. package/dist/src/enums/bytes.d.ts +25 -0
  61. package/dist/src/enums/bytes.js +63 -0
  62. package/dist/src/enums/bytes.js.map +1 -0
  63. package/dist/src/enums/constants.d.ts +4 -0
  64. package/dist/src/enums/constants.js +8 -0
  65. package/dist/src/enums/constants.js.map +1 -0
  66. package/dist/src/enums/definitions.json +3068 -0
  67. package/dist/src/enums/field.d.ts +28 -0
  68. package/dist/src/enums/field.js +58 -0
  69. package/dist/src/enums/field.js.map +1 -0
  70. package/dist/src/enums/index.d.ts +12 -0
  71. package/dist/src/enums/index.js +31 -0
  72. package/dist/src/enums/index.js.map +1 -0
  73. package/dist/src/enums/utils-renumber.d.ts +101 -0
  74. package/dist/src/enums/utils-renumber.js +127 -0
  75. package/dist/src/enums/utils-renumber.js.map +1 -0
  76. package/dist/src/enums/xrpl-definitions-base.d.ts +44 -0
  77. package/dist/src/enums/xrpl-definitions-base.js +59 -0
  78. package/dist/src/enums/xrpl-definitions-base.js.map +1 -0
  79. package/dist/src/enums/xrpl-definitions.d.ts +21 -0
  80. package/dist/src/enums/xrpl-definitions.js +29 -0
  81. package/dist/src/enums/xrpl-definitions.js.map +1 -0
  82. package/dist/src/hash-prefixes.d.ts +5 -0
  83. package/dist/src/hash-prefixes.js +41 -0
  84. package/dist/src/hash-prefixes.js.map +1 -0
  85. package/dist/src/hashes.d.ts +50 -0
  86. package/dist/src/hashes.js +76 -0
  87. package/dist/src/hashes.js.map +1 -0
  88. package/dist/src/index.d.ts +64 -0
  89. package/dist/src/index.js +123 -0
  90. package/dist/src/index.js.map +1 -0
  91. package/dist/src/ledger-hashes.d.ts +48 -0
  92. package/dist/src/ledger-hashes.js +141 -0
  93. package/dist/src/ledger-hashes.js.map +1 -0
  94. package/dist/src/quality.d.ts +21 -0
  95. package/dist/src/quality.js +42 -0
  96. package/dist/src/quality.js.map +1 -0
  97. package/dist/src/serdes/binary-parser.d.ts +100 -0
  98. package/dist/src/serdes/binary-parser.js +194 -0
  99. package/dist/src/serdes/binary-parser.js.map +1 -0
  100. package/dist/src/serdes/binary-serializer.d.ts +81 -0
  101. package/dist/src/serdes/binary-serializer.js +149 -0
  102. package/dist/src/serdes/binary-serializer.js.map +1 -0
  103. package/dist/src/shamap.d.ts +102 -0
  104. package/dist/src/shamap.js +172 -0
  105. package/dist/src/shamap.js.map +1 -0
  106. package/dist/src/types/account-id.d.ts +35 -0
  107. package/dist/src/types/account-id.js +69 -0
  108. package/dist/src/types/account-id.js.map +1 -0
  109. package/dist/src/types/amount.d.ts +91 -0
  110. package/dist/src/types/amount.js +289 -0
  111. package/dist/src/types/amount.js.map +1 -0
  112. package/dist/src/types/blob.d.ts +24 -0
  113. package/dist/src/types/blob.js +43 -0
  114. package/dist/src/types/blob.js.map +1 -0
  115. package/dist/src/types/currency.d.ts +28 -0
  116. package/dist/src/types/currency.js +127 -0
  117. package/dist/src/types/currency.js.map +1 -0
  118. package/dist/src/types/hash-128.d.ts +16 -0
  119. package/dist/src/types/hash-128.js +32 -0
  120. package/dist/src/types/hash-128.js.map +1 -0
  121. package/dist/src/types/hash-160.d.ts +10 -0
  122. package/dist/src/types/hash-160.js +19 -0
  123. package/dist/src/types/hash-160.js.map +1 -0
  124. package/dist/src/types/hash-192.d.ts +10 -0
  125. package/dist/src/types/hash-192.js +19 -0
  126. package/dist/src/types/hash-192.js.map +1 -0
  127. package/dist/src/types/hash-256.d.ts +10 -0
  128. package/dist/src/types/hash-256.js +16 -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 +73 -0
  132. package/dist/src/types/hash.js.map +1 -0
  133. package/dist/src/types/index.d.ts +19 -0
  134. package/dist/src/types/index.js +64 -0
  135. package/dist/src/types/index.js.map +1 -0
  136. package/dist/src/types/issue.d.ts +38 -0
  137. package/dist/src/types/issue.js +81 -0
  138. package/dist/src/types/issue.js.map +1 -0
  139. package/dist/src/types/path-set.d.ts +36 -0
  140. package/dist/src/types/path-set.js +233 -0
  141. package/dist/src/types/path-set.js.map +1 -0
  142. package/dist/src/types/serialized-type.d.ts +70 -0
  143. package/dist/src/types/serialized-type.js +105 -0
  144. package/dist/src/types/serialized-type.js.map +1 -0
  145. package/dist/src/types/st-array.d.ts +31 -0
  146. package/dist/src/types/st-array.js +86 -0
  147. package/dist/src/types/st-array.js.map +1 -0
  148. package/dist/src/types/st-object.d.ts +32 -0
  149. package/dist/src/types/st-object.js +155 -0
  150. package/dist/src/types/st-object.js.map +1 -0
  151. package/dist/src/types/uint-16.d.ts +24 -0
  152. package/dist/src/types/uint-16.js +45 -0
  153. package/dist/src/types/uint-16.js.map +1 -0
  154. package/dist/src/types/uint-32.d.ts +24 -0
  155. package/dist/src/types/uint-32.js +50 -0
  156. package/dist/src/types/uint-32.js.map +1 -0
  157. package/dist/src/types/uint-64.d.ts +37 -0
  158. package/dist/src/types/uint-64.js +86 -0
  159. package/dist/src/types/uint-64.js.map +1 -0
  160. package/dist/src/types/uint-8.d.ts +24 -0
  161. package/dist/src/types/uint-8.js +46 -0
  162. package/dist/src/types/uint-8.js.map +1 -0
  163. package/dist/src/types/uint.d.ts +29 -0
  164. package/dist/src/types/uint.js +47 -0
  165. package/dist/src/types/uint.js.map +1 -0
  166. package/dist/src/types/vector-256.d.ts +30 -0
  167. package/dist/src/types/vector-256.js +73 -0
  168. package/dist/src/types/vector-256.js.map +1 -0
  169. package/dist/src/types/xchain-bridge.d.ts +44 -0
  170. package/dist/src/types/xchain-bridge.js +102 -0
  171. package/dist/src/types/xchain-bridge.js.map +1 -0
  172. package/dist/src/utils.d.ts +47 -0
  173. package/dist/src/utils.js +137 -0
  174. package/dist/src/utils.js.map +1 -0
  175. package/dist/tsconfig.tsbuildinfo +1 -0
  176. package/dist/types/account-id.d.ts +2 -3
  177. package/dist/types/account-id.js +29 -37
  178. package/dist/types/account-id.js.map +1 -1
  179. package/dist/types/amount.d.ts +33 -10
  180. package/dist/types/amount.js +181 -101
  181. package/dist/types/amount.js.map +1 -1
  182. package/dist/types/blob.d.ts +3 -4
  183. package/dist/types/blob.js +16 -27
  184. package/dist/types/blob.js.map +1 -1
  185. package/dist/types/currency.d.ts +5 -13
  186. package/dist/types/currency.js +53 -66
  187. package/dist/types/currency.js.map +1 -1
  188. package/dist/types/hash-128.d.ts +8 -3
  189. package/dist/types/hash-128.js +23 -22
  190. package/dist/types/hash-128.js.map +1 -1
  191. package/dist/types/hash-160.d.ts +2 -3
  192. package/dist/types/hash-160.js +7 -24
  193. package/dist/types/hash-160.js.map +1 -1
  194. package/dist/types/hash-192.d.ts +10 -0
  195. package/dist/types/hash-192.js +19 -0
  196. package/dist/types/hash-192.js.map +1 -0
  197. package/dist/types/hash-256.d.ts +2 -3
  198. package/dist/types/hash-256.js +7 -22
  199. package/dist/types/hash-256.js.map +1 -1
  200. package/dist/types/hash.d.ts +4 -5
  201. package/dist/types/hash.js +25 -39
  202. package/dist/types/hash.js.map +1 -1
  203. package/dist/types/index.d.ts +19 -33
  204. package/dist/types/index.js +44 -24
  205. package/dist/types/index.js.map +1 -1
  206. package/dist/types/issue.d.ts +38 -0
  207. package/dist/types/issue.js +81 -0
  208. package/dist/types/issue.js.map +1 -0
  209. package/dist/types/path-set.d.ts +2 -2
  210. package/dist/types/path-set.js +73 -94
  211. package/dist/types/path-set.js.map +1 -1
  212. package/dist/types/serialized-type.d.ts +26 -18
  213. package/dist/types/serialized-type.js +50 -60
  214. package/dist/types/serialized-type.js.map +1 -1
  215. package/dist/types/st-array.d.ts +7 -4
  216. package/dist/types/st-array.js +36 -47
  217. package/dist/types/st-array.js.map +1 -1
  218. package/dist/types/st-object.d.ts +8 -5
  219. package/dist/types/st-object.js +73 -74
  220. package/dist/types/st-object.js.map +1 -1
  221. package/dist/types/uint-16.d.ts +3 -4
  222. package/dist/types/uint-16.js +20 -33
  223. package/dist/types/uint-16.js.map +1 -1
  224. package/dist/types/uint-32.d.ts +3 -4
  225. package/dist/types/uint-32.js +23 -36
  226. package/dist/types/uint-32.js.map +1 -1
  227. package/dist/types/uint-64.d.ts +5 -6
  228. package/dist/types/uint-64.js +44 -48
  229. package/dist/types/uint-64.js.map +1 -1
  230. package/dist/types/uint-8.d.ts +3 -4
  231. package/dist/types/uint-8.js +21 -33
  232. package/dist/types/uint-8.js.map +1 -1
  233. package/dist/types/uint.d.ts +5 -5
  234. package/dist/types/uint.js +17 -27
  235. package/dist/types/uint.js.map +1 -1
  236. package/dist/types/vector-256.d.ts +3 -4
  237. package/dist/types/vector-256.js +28 -45
  238. package/dist/types/vector-256.js.map +1 -1
  239. package/dist/types/xchain-bridge.d.ts +44 -0
  240. package/dist/types/xchain-bridge.js +102 -0
  241. package/dist/types/xchain-bridge.js.map +1 -0
  242. package/dist/utils.d.ts +47 -0
  243. package/dist/utils.js +137 -0
  244. package/dist/utils.js.map +1 -0
  245. package/package.json +23 -33
  246. package/src/README.md +5 -0
  247. package/src/binary.ts +194 -0
  248. package/src/coretypes.ts +31 -0
  249. package/src/enums/README.md +144 -0
  250. package/src/enums/bytes.ts +74 -0
  251. package/src/enums/constants.ts +4 -0
  252. package/src/enums/definitions.json +3073 -0
  253. package/src/enums/field.ts +84 -0
  254. package/src/enums/index.ts +34 -0
  255. package/src/enums/utils-renumber.ts +134 -0
  256. package/src/enums/xrpl-definitions-base.ts +111 -0
  257. package/src/enums/xrpl-definitions.ts +32 -0
  258. package/src/hash-prefixes.ts +40 -0
  259. package/src/hashes.ts +75 -0
  260. package/src/index.ts +153 -0
  261. package/src/ledger-hashes.ts +191 -0
  262. package/src/quality.ts +38 -0
  263. package/src/serdes/binary-parser.ts +228 -0
  264. package/src/serdes/binary-serializer.ts +166 -0
  265. package/src/shamap.ts +186 -0
  266. package/src/types/account-id.ts +86 -0
  267. package/src/types/amount.ts +362 -0
  268. package/src/types/blob.ts +46 -0
  269. package/src/types/currency.ts +140 -0
  270. package/src/types/hash-128.ts +33 -0
  271. package/src/types/hash-160.ts +19 -0
  272. package/src/types/hash-192.ts +19 -0
  273. package/src/types/hash-256.ts +15 -0
  274. package/src/types/hash.ts +83 -0
  275. package/src/types/index.ts +66 -0
  276. package/src/types/issue.ts +96 -0
  277. package/src/types/path-set.ts +290 -0
  278. package/src/types/serialized-type.ts +122 -0
  279. package/src/types/st-array.ts +113 -0
  280. package/src/types/st-object.ts +192 -0
  281. package/src/types/uint-16.ts +53 -0
  282. package/src/types/uint-32.ts +59 -0
  283. package/src/types/uint-64.ts +104 -0
  284. package/src/types/uint-8.ts +52 -0
  285. package/src/types/uint.ts +60 -0
  286. package/src/types/vector-256.ts +79 -0
  287. package/src/types/xchain-bridge.ts +128 -0
  288. package/src/utils.ts +152 -0
  289. package/HISTORY.md +0 -74
  290. package/test/amount.test.js +0 -43
  291. package/test/binary-json.test.js +0 -47
  292. package/test/binary-parser.test.js +0 -397
  293. package/test/binary-serializer.test.js +0 -248
  294. package/test/fixtures/account-tx-transactions.db +0 -0
  295. package/test/fixtures/codec-fixtures.json +0 -4466
  296. package/test/fixtures/data-driven-tests.json +0 -3721
  297. package/test/fixtures/delivermin-tx-binary.json +0 -1
  298. package/test/fixtures/delivermin-tx.json +0 -98
  299. package/test/fixtures/deposit-preauth-tx-binary.json +0 -1
  300. package/test/fixtures/deposit-preauth-tx-meta-binary.json +0 -1
  301. package/test/fixtures/deposit-preauth-tx.json +0 -58
  302. package/test/fixtures/escrow-cancel-binary.json +0 -1
  303. package/test/fixtures/escrow-cancel-tx.json +0 -6
  304. package/test/fixtures/escrow-create-binary.json +0 -1
  305. package/test/fixtures/escrow-create-tx.json +0 -10
  306. package/test/fixtures/escrow-finish-binary.json +0 -1
  307. package/test/fixtures/escrow-finish-meta-binary.json +0 -1
  308. package/test/fixtures/escrow-finish-tx.json +0 -95
  309. package/test/fixtures/ledger-full-38129.json +0 -1
  310. package/test/fixtures/ledger-full-40000.json +0 -1
  311. package/test/fixtures/negative-unl.json +0 -12
  312. package/test/fixtures/payment-channel-claim-binary.json +0 -1
  313. package/test/fixtures/payment-channel-claim-tx.json +0 -8
  314. package/test/fixtures/payment-channel-create-binary.json +0 -1
  315. package/test/fixtures/payment-channel-create-tx.json +0 -11
  316. package/test/fixtures/payment-channel-fund-binary.json +0 -1
  317. package/test/fixtures/payment-channel-fund-tx.json +0 -7
  318. package/test/fixtures/signerlistset-tx-binary.json +0 -1
  319. package/test/fixtures/signerlistset-tx-meta-binary.json +0 -1
  320. package/test/fixtures/signerlistset-tx.json +0 -94
  321. package/test/fixtures/x-codec-fixtures.json +0 -188
  322. package/test/hash.test.js +0 -82
  323. package/test/ledger.test.js +0 -29
  324. package/test/lower-case-hex.test.js +0 -45
  325. package/test/pseudo-transaction.test.js +0 -38
  326. package/test/quality.test.js +0 -15
  327. package/test/shamap.test.js +0 -88
  328. package/test/signing-data-encoding.test.js +0 -129
  329. package/test/tx-encode-decode.test.js +0 -80
  330. package/test/types.test.js +0 -34
  331. package/test/uint.test.js +0 -40
  332. package/test/utils.js +0 -29
  333. package/test/x-address.test.js +0 -147
@@ -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,82 +0,0 @@
1
- const { coreTypes } = require("../dist/types");
2
- const { Hash160, Hash256, AccountID, Currency } = coreTypes;
3
-
4
- describe("Hash160", function () {
5
- test("has a static width member", function () {
6
- expect(Hash160.width).toBe(20);
7
- });
8
- test("inherited by subclasses", function () {
9
- expect(AccountID.width).toBe(20);
10
- expect(Currency.width).toBe(20);
11
- });
12
- test("can be compared against another", function () {
13
- const h1 = Hash160.from("1000000000000000000000000000000000000000");
14
- const h2 = Hash160.from("2000000000000000000000000000000000000000");
15
- const h3 = Hash160.from("0000000000000000000000000000000000000003");
16
- expect(h1.lt(h2)).toBe(true);
17
- expect(h3.lt(h2)).toBe(true);
18
- });
19
- test("throws when constructed from invalid hash length", () => {
20
- expect(() =>
21
- Hash160.from("10000000000000000000000000000000000000")
22
- ).toThrow("Invalid Hash length 19");
23
- expect(() =>
24
- Hash160.from("100000000000000000000000000000000000000000")
25
- ).toThrow("Invalid Hash length 21");
26
- });
27
- });
28
-
29
- describe("Hash256", function () {
30
- test("has a static width member", function () {
31
- expect(Hash256.width).toBe(32);
32
- });
33
- test("has a ZERO_256 member", function () {
34
- expect(Hash256.ZERO_256.toJSON()).toBe(
35
- "0000000000000000000000000000000000000000000000000000000000000000"
36
- );
37
- });
38
- test("supports getting the nibblet values at given positions", function () {
39
- const h = Hash256.from(
40
- "1359BD0000000000000000000000000000000000000000000000000000000000"
41
- );
42
- expect(h.nibblet(0)).toBe(0x1);
43
- expect(h.nibblet(1)).toBe(0x3);
44
- expect(h.nibblet(2)).toBe(0x5);
45
- expect(h.nibblet(3)).toBe(0x9);
46
- expect(h.nibblet(4)).toBe(0x0b);
47
- expect(h.nibblet(5)).toBe(0xd);
48
- });
49
- });
50
-
51
- describe("Currency", function () {
52
- test("Will have a null iso() for dodgy XRP ", function () {
53
- const bad = Currency.from("0000000000000000000000005852500000000000");
54
- expect(bad.iso()).toBeUndefined();
55
- expect(bad.isNative()).toBe(false);
56
- });
57
- test("Currency with lowercase letters decode to hex", () => {
58
- expect(Currency.from("xRp").toJSON()).toBe(
59
- "0000000000000000000000007852700000000000"
60
- );
61
- });
62
- test("Currency codes with symbols decode to hex", () => {
63
- expect(Currency.from("x|p").toJSON()).toBe(
64
- "000000000000000000000000787C700000000000"
65
- );
66
- });
67
- test("Currency codes with uppercase and 0-9 decode to ISO codes", () => {
68
- expect(Currency.from("X8P").toJSON()).toBe("X8P");
69
- expect(Currency.from("USD").toJSON()).toBe("USD");
70
- });
71
- test("can be constructed from a Buffer", function () {
72
- const xrp = new Currency(Buffer.alloc(20));
73
- expect(xrp.iso()).toBe("XRP");
74
- });
75
- test("throws on invalid reprs", function () {
76
- expect(() => Currency.from(Buffer.alloc(19))).toThrow();
77
- expect(() => Currency.from(1)).toThrow();
78
- expect(() =>
79
- Currency.from("00000000000000000000000000000000000000m")
80
- ).toThrow();
81
- });
82
- });
@@ -1,29 +0,0 @@
1
- const { loadFixture } = require("./utils");
2
- const {
3
- transactionTreeHash,
4
- ledgerHash,
5
- accountStateHash,
6
- } = require("../dist/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,45 +0,0 @@
1
- const { encode, decode } = require("../dist");
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: "0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5".toLowerCase(),
15
- Flags: 0,
16
- Sequence: 1,
17
- Balance: "10000000000",
18
- };
19
-
20
- let jsonUpper = {
21
- OwnerCount: 0,
22
- Account: "rUnFEsHjxqTswbivzL2DNHBb34rhAgZZZK",
23
- PreviousTxnLgrSeq: 8,
24
- LedgerEntryType: "AccountRoot",
25
- PreviousTxnID:
26
- "0735A0B32B2A3F4C938B76D6933003E29447DB8C7CE382BBE089402FF12A03E5",
27
- Flags: 0,
28
- Sequence: 1,
29
- Balance: "10000000000",
30
- };
31
-
32
- describe("Lowercase hex test", () => {
33
- test("Correctly decodes", () => {
34
- expect(decode(lower)).toEqual(decode(str));
35
- });
36
- test("Re-encodes to uppercase hex", () => {
37
- expect(encode(decode(lower))).toEqual(str);
38
- });
39
- test("Encode when hex field lowercase", () => {
40
- expect(encode(json)).toBe(bin);
41
- });
42
- test("Re-decodes to uppercase hex", () => {
43
- expect(decode(encode(json))).toEqual(jsonUpper);
44
- });
45
- });
@@ -1,38 +0,0 @@
1
- const { encode, decode } = require("../dist");
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("../dist/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
- });
@@ -1,88 +0,0 @@
1
- const { ShaMap } = require("../dist/shamap.js");
2
- const { binary, HashPrefix } = require("../dist/coretypes");
3
- const { coreTypes } = require("../dist/types");
4
- const { loadFixture } = require("./utils");
5
-
6
- function now() {
7
- return Number(Date.now()) / 1000;
8
- }
9
-
10
- const ZERO = "0000000000000000000000000000000000000000000000000000000000000000";
11
-
12
- function makeItem(indexArg) {
13
- let str = indexArg;
14
- while (str.length < 64) {
15
- str += "0";
16
- }
17
- const index = coreTypes.Hash256.from(str);
18
- const item = {
19
- toBytesSink(sink) {
20
- index.toBytesSink(sink);
21
- },
22
- hashPrefix() {
23
- return Buffer.from([1, 3, 3, 7]);
24
- },
25
- };
26
- return [index, item];
27
- }
28
-
29
- describe("ShaMap", () => {
30
- now();
31
-
32
- test("hashes to zero when empty", () => {
33
- const map = new ShaMap();
34
- expect(map.hash().toHex()).toBe(ZERO);
35
- });
36
- test("creates the same hash no matter which order items are added", () => {
37
- let map = new ShaMap();
38
- const items = [
39
- "0",
40
- "1",
41
- "11",
42
- "7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E20000000000000000",
43
- "7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E21000000000000000",
44
- "7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E22000000000000000",
45
- "7000DE445E22CB9BB7E1717589FA858736BAA5FD192310E23000000000000000",
46
- "12",
47
- "122",
48
- ];
49
- items.forEach((i) => map.addItem(...makeItem(i)));
50
- const h1 = map.hash();
51
- expect(h1.eq(h1)).toBe(true);
52
- map = new ShaMap();
53
- items.reverse().forEach((i) => map.addItem(...makeItem(i)));
54
- expect(map.hash()).toStrictEqual(h1);
55
- });
56
- function factory(fixture) {
57
- test(`recreate account state hash from ${fixture}`, () => {
58
- const map = new ShaMap();
59
- const ledger = loadFixture(fixture);
60
- // const t = now();
61
- const leafNodePrefix = HashPrefix.accountStateEntry;
62
- ledger.accountState
63
- .map((e, i) => {
64
- if ((i > 1000) & (i % 1000 === 0)) {
65
- console.log(e.index);
66
- console.log(i);
67
- }
68
- const bytes = binary.serializeObject(e);
69
- return {
70
- index: coreTypes.Hash256.from(e.index),
71
- hashPrefix() {
72
- return leafNodePrefix;
73
- },
74
- toBytesSink(sink) {
75
- sink.put(bytes);
76
- },
77
- };
78
- })
79
- .forEach((so) => map.addItem(so.index, so));
80
- expect(map.hash().toHex()).toBe(ledger.account_hash);
81
- // console.log('took seconds: ', (now() - t));
82
- });
83
- }
84
- factory("ledger-full-38129.json");
85
- factory("ledger-full-40000.json");
86
- // factory('ledger-4320277.json');
87
- // factory('14280680.json');
88
- });
@@ -1,129 +0,0 @@
1
- const {
2
- encodeForSigning,
3
- encodeForSigningClaim,
4
- encodeForMultisigning,
5
- } = require("../dist");
6
-
7
- const tx_json = {
8
- Account: "r9LqNeG6qHxjeUocjvVki2XR35weJ9mZgQ",
9
- Amount: "1000",
10
- Destination: "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
11
- Fee: "10",
12
- Flags: 2147483648,
13
- Sequence: 1,
14
- TransactionType: "Payment",
15
- TxnSignature:
16
- "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1" +
17
- "E721B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80" +
18
- "ECA3CD7B9B",
19
- Signature:
20
- "30440220718D264EF05CAED7C781FF6DE298DCAC68D002562C9BF3A07C1E72" +
21
- "1B420C0DAB02203A5A4779EF4D2CCC7BC3EF886676D803A9981B928D3B8ACA483B80ECA" +
22
- "3CD7B9B",
23
- SigningPubKey:
24
- "ED5F5AC8B98974A3CA843326D9B88CEBD0560177B973EE0B149F782CFAA06DC66A",
25
- };
26
-
27
- describe("Signing data", function () {
28
- test("can create single signing blobs", function () {
29
- const actual = encodeForSigning(tx_json);
30
- expect(actual).toBe(
31
- [
32
- "53545800", // signingPrefix
33
- // TransactionType
34
- "12",
35
- "0000",
36
- // Flags
37
- "22",
38
- "80000000",
39
- // Sequence
40
- "24",
41
- "00000001",
42
- // Amount
43
- "61",
44
- // native amount
45
- "40000000000003E8",
46
- // Fee
47
- "68",
48
- // native amount
49
- "400000000000000A",
50
- // SigningPubKey
51
- "73",
52
- // VLLength
53
- "21",
54
- "ED5F5AC8B98974A3CA843326D9B88CEBD0560177B973EE0B149F782CFAA06DC66A",
55
- // Account
56
- "81",
57
- // VLLength
58
- "14",
59
- "5B812C9D57731E27A2DA8B1830195F88EF32A3B6",
60
- // Destination
61
- "83",
62
- // VLLength
63
- "14",
64
- "B5F762798A53D543A014CAF8B297CFF8F2F937E8",
65
- ].join("")
66
- );
67
- });
68
- test("can create multi signing blobs", function () {
69
- const signingAccount = "rJZdUusLDtY9NEsGea7ijqhVrXv98rYBYN";
70
- const signingJson = Object.assign({}, tx_json, { SigningPubKey: "" });
71
- const actual = encodeForMultisigning(signingJson, signingAccount);
72
- expect(actual).toBe(
73
- [
74
- "534D5400", // signingPrefix
75
- // TransactionType
76
- "12",
77
- "0000",
78
- // Flags
79
- "22",
80
- "80000000",
81
- // Sequence
82
- "24",
83
- "00000001",
84
- // Amount
85
- "61",
86
- // native amount
87
- "40000000000003E8",
88
- // Fee
89
- "68",
90
- // native amount
91
- "400000000000000A",
92
- // SigningPubKey
93
- "73",
94
- // VLLength
95
- "00",
96
- // '',
97
- // Account
98
- "81",
99
- // VLLength
100
- "14",
101
- "5B812C9D57731E27A2DA8B1830195F88EF32A3B6",
102
- // Destination
103
- "83",
104
- // VLLength
105
- "14",
106
- "B5F762798A53D543A014CAF8B297CFF8F2F937E8",
107
- // signingAccount suffix
108
- "C0A5ABEF242802EFED4B041E8F2D4A8CC86AE3D1",
109
- ].join("")
110
- );
111
- });
112
- test("can create claim blob", function () {
113
- const channel =
114
- "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1";
115
- const amount = "1000";
116
- const json = { channel, amount };
117
- const actual = encodeForSigningClaim(json);
118
- expect(actual).toBe(
119
- [
120
- // hash prefix
121
- "434C4D00",
122
- // channel ID
123
- "43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1",
124
- // amount as a uint64
125
- "00000000000003E8",
126
- ].join("")
127
- );
128
- });
129
- });