ripple-binary-codec 1.1.3 → 1.1.4-beta.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 (108) hide show
  1. package/README.md +2 -107
  2. package/dist/binary.d.ts +6 -6
  3. package/dist/binary.js.map +1 -1
  4. package/dist/coretypes.d.ts +8 -8
  5. package/dist/coretypes.js.map +1 -1
  6. package/dist/enums/definitions.json +190 -4
  7. package/dist/enums/index.d.ts +6 -5
  8. package/dist/enums/index.js +2 -1
  9. package/dist/enums/index.js.map +1 -1
  10. package/dist/enums/utils-renumber.js +7 -7
  11. package/dist/enums/utils-renumber.js.map +1 -1
  12. package/dist/hash-prefixes.d.ts +1 -1
  13. package/dist/hash-prefixes.js.map +1 -1
  14. package/dist/hashes.d.ts +3 -3
  15. package/dist/hashes.js +3 -3
  16. package/dist/hashes.js.map +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +13 -13
  19. package/dist/index.js.map +1 -1
  20. package/dist/ledger-hashes.d.ts +3 -3
  21. package/dist/ledger-hashes.js +4 -4
  22. package/dist/ledger-hashes.js.map +1 -1
  23. package/dist/quality.d.ts +2 -2
  24. package/dist/quality.js +2 -2
  25. package/dist/quality.js.map +1 -1
  26. package/dist/serdes/binary-parser.d.ts +3 -3
  27. package/dist/serdes/binary-parser.js +8 -8
  28. package/dist/serdes/binary-parser.js.map +1 -1
  29. package/dist/serdes/binary-serializer.d.ts +5 -5
  30. package/dist/serdes/binary-serializer.js +11 -8
  31. package/dist/serdes/binary-serializer.js.map +1 -1
  32. package/dist/shamap.d.ts +3 -3
  33. package/dist/shamap.js +2 -2
  34. package/dist/shamap.js.map +1 -1
  35. package/dist/types/account-id.d.ts +2 -2
  36. package/dist/types/account-id.js +5 -5
  37. package/dist/types/account-id.js.map +1 -1
  38. package/dist/types/amount.d.ts +3 -3
  39. package/dist/types/amount.js +15 -15
  40. package/dist/types/amount.js.map +1 -1
  41. package/dist/types/blob.d.ts +3 -3
  42. package/dist/types/blob.js +3 -3
  43. package/dist/types/blob.js.map +1 -1
  44. package/dist/types/currency.d.ts +5 -12
  45. package/dist/types/currency.js +28 -29
  46. package/dist/types/currency.js.map +1 -1
  47. package/dist/types/hash-128.d.ts +2 -2
  48. package/dist/types/hash-128.js.map +1 -1
  49. package/dist/types/hash-160.d.ts +2 -2
  50. package/dist/types/hash-160.js.map +1 -1
  51. package/dist/types/hash-256.d.ts +2 -2
  52. package/dist/types/hash-256.js.map +1 -1
  53. package/dist/types/hash.d.ts +3 -3
  54. package/dist/types/hash.js +3 -3
  55. package/dist/types/hash.js.map +1 -1
  56. package/dist/types/index.d.ts +15 -15
  57. package/dist/types/index.js +3 -3
  58. package/dist/types/index.js.map +1 -1
  59. package/dist/types/path-set.d.ts +2 -2
  60. package/dist/types/path-set.js +2 -2
  61. package/dist/types/path-set.js.map +1 -1
  62. package/dist/types/serialized-type.d.ts +4 -4
  63. package/dist/types/serialized-type.js +3 -3
  64. package/dist/types/serialized-type.js.map +1 -1
  65. package/dist/types/st-array.d.ts +2 -2
  66. package/dist/types/st-array.js +3 -3
  67. package/dist/types/st-array.js.map +1 -1
  68. package/dist/types/st-object.d.ts +2 -2
  69. package/dist/types/st-object.js +16 -11
  70. package/dist/types/st-object.js.map +1 -1
  71. package/dist/types/uint-16.d.ts +3 -3
  72. package/dist/types/uint-16.js +2 -2
  73. package/dist/types/uint-16.js.map +1 -1
  74. package/dist/types/uint-32.d.ts +3 -3
  75. package/dist/types/uint-32.js +3 -3
  76. package/dist/types/uint-32.js.map +1 -1
  77. package/dist/types/uint-64.d.ts +4 -4
  78. package/dist/types/uint-64.js +7 -7
  79. package/dist/types/uint-64.js.map +1 -1
  80. package/dist/types/uint-8.d.ts +3 -3
  81. package/dist/types/uint-8.js +2 -2
  82. package/dist/types/uint-8.js.map +1 -1
  83. package/dist/types/uint.d.ts +3 -3
  84. package/dist/types/uint.js +1 -1
  85. package/dist/types/uint.js.map +1 -1
  86. package/dist/types/vector-256.d.ts +3 -3
  87. package/dist/types/vector-256.js +4 -4
  88. package/dist/types/vector-256.js.map +1 -1
  89. package/package.json +2 -2
  90. package/test/amount.test.js +29 -29
  91. package/test/binary-json.test.js +24 -26
  92. package/test/binary-parser.test.js +226 -228
  93. package/test/binary-serializer.test.js +194 -169
  94. package/test/fixtures/data-driven-tests.json +2 -790
  95. package/test/fixtures/negative-unl.json +4 -4
  96. package/test/fixtures/nf-token.json +547 -0
  97. package/test/hash.test.js +79 -75
  98. package/test/ledger.test.js +19 -19
  99. package/test/lower-case-hex.test.js +29 -28
  100. package/test/pseudo-transaction.test.js +26 -26
  101. package/test/quality.test.js +13 -13
  102. package/test/shamap.test.js +54 -54
  103. package/test/signing-data-encoding.test.js +79 -79
  104. package/test/tx-encode-decode.test.js +63 -63
  105. package/test/types.test.js +23 -23
  106. package/test/uint.test.js +107 -107
  107. package/test/x-address.test.js +106 -106
  108. package/HISTORY.md +0 -90
package/test/uint.test.js CHANGED
@@ -1,148 +1,148 @@
1
- const { coreTypes } = require("../dist/types");
2
- const { UInt8, UInt64 } = coreTypes;
1
+ const { coreTypes } = require('../dist/types')
2
+ const { UInt8, UInt64 } = coreTypes
3
3
 
4
- const { encode } = require("../dist");
4
+ const { encode } = require('../dist')
5
5
 
6
6
  const binary =
7
- "11007222000300003700000000000000003800000000000000006280000000000000000000000000000000000000005553440000000000000000000000000000000000000000000000000166D5438D7EA4C680000000000000000000000000005553440000000000AE123A8556F3CF91154711376AFB0F894F832B3D67D5438D7EA4C680000000000000000000000000005553440000000000F51DFC2A09D62CBBA1DFBDD4691DAC96AD98B90F";
7
+ '11007222000300003700000000000000003800000000000000006280000000000000000000000000000000000000005553440000000000000000000000000000000000000000000000000166D5438D7EA4C680000000000000000000000000005553440000000000AE123A8556F3CF91154711376AFB0F894F832B3D67D5438D7EA4C680000000000000000000000000005553440000000000F51DFC2A09D62CBBA1DFBDD4691DAC96AD98B90F'
8
8
  const json = {
9
9
  Balance: {
10
- currency: "USD",
11
- issuer: "rrrrrrrrrrrrrrrrrrrrBZbvji",
12
- value: "0",
10
+ currency: 'USD',
11
+ issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
12
+ value: '0',
13
13
  },
14
14
  Flags: 196608,
15
15
  HighLimit: {
16
- currency: "USD",
17
- issuer: "rPMh7Pi9ct699iZUTWaytJUoHcJ7cgyziK",
18
- value: "1000",
16
+ currency: 'USD',
17
+ issuer: 'rPMh7Pi9ct699iZUTWaytJUoHcJ7cgyziK',
18
+ value: '1000',
19
19
  },
20
- HighNode: "0",
21
- LedgerEntryType: "RippleState",
20
+ HighNode: '0',
21
+ LedgerEntryType: 'RippleState',
22
22
  LowLimit: {
23
- currency: "USD",
24
- issuer: "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn",
25
- value: "1000",
23
+ currency: 'USD',
24
+ issuer: 'rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn',
25
+ value: '1000',
26
26
  },
27
- LowNode: "0",
28
- };
27
+ LowNode: '0',
28
+ }
29
29
 
30
30
  const binaryEntry0 =
31
- "11007222001100002501EC24873700000000000000003800000000000000A35506FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA62D44BF89AC2A40B800000000000000000000000004A50590000000000000000000000000000000000000000000000000166D6C38D7EA4C680000000000000000000000000004A5059000000000047C1258B4B79774B28176324068F759EDE226F686780000000000000000000000000000000000000004A505900000000005BBC0F22F61D9224A110650CFE21CC0C4BE13098";
31
+ '11007222001100002501EC24873700000000000000003800000000000000A35506FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA62D44BF89AC2A40B800000000000000000000000004A50590000000000000000000000000000000000000000000000000166D6C38D7EA4C680000000000000000000000000004A5059000000000047C1258B4B79774B28176324068F759EDE226F686780000000000000000000000000000000000000004A505900000000005BBC0F22F61D9224A110650CFE21CC0C4BE13098'
32
32
  const jsonEntry0 = {
33
33
  Balance: {
34
- currency: "JPY",
35
- issuer: "rrrrrrrrrrrrrrrrrrrrBZbvji",
36
- value: "0.3369568318",
34
+ currency: 'JPY',
35
+ issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
36
+ value: '0.3369568318',
37
37
  },
38
38
  Flags: 1114112,
39
39
  HighLimit: {
40
- currency: "JPY",
41
- issuer: "r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN",
42
- value: "0",
40
+ currency: 'JPY',
41
+ issuer: 'r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN',
42
+ value: '0',
43
43
  },
44
- HighNode: "a3",
45
- LedgerEntryType: "RippleState",
44
+ HighNode: 'a3',
45
+ LedgerEntryType: 'RippleState',
46
46
  LowLimit: {
47
- currency: "JPY",
48
- issuer: "rfYQMgj3g3Qp8VLoZNvvU35mEuuJC8nCmY",
49
- value: "1000000000",
47
+ currency: 'JPY',
48
+ issuer: 'rfYQMgj3g3Qp8VLoZNvvU35mEuuJC8nCmY',
49
+ value: '1000000000',
50
50
  },
51
- LowNode: "0",
51
+ LowNode: '0',
52
52
  PreviousTxnID:
53
- "06FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA",
53
+ '06FC7DE374089D50F81AAE13E7BBF3D0E694769331E14F55351B38D0148018EA',
54
54
  PreviousTxnLgrSeq: 32253063,
55
- index: "000319BAE0A618A7D3BB492F17E98E5D92EA0C6458AFEBED44206B5B4798A840",
56
- };
55
+ index: '000319BAE0A618A7D3BB492F17E98E5D92EA0C6458AFEBED44206B5B4798A840',
56
+ }
57
57
 
58
58
  const binaryEntry1 =
59
- "1100642200000000320000000000000002580CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E7528214BA53D10260FFCC968ACD16BA30F7CEABAD6E5D92011340A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6AE1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F";
59
+ '1100642200000000320000000000000002580CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E7528214BA53D10260FFCC968ACD16BA30F7CEABAD6E5D92011340A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6AE1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F'
60
60
  const jsonEntry1 = {
61
61
  Flags: 0,
62
- IndexPrevious: "2",
62
+ IndexPrevious: '2',
63
63
  Indexes: [
64
- "A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6A",
65
- "E1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F",
64
+ 'A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6A',
65
+ 'E1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F',
66
66
  ],
67
- LedgerEntryType: "DirectoryNode",
68
- Owner: "rHzDaMNybxQppiE3uWyt2N265KvAKdiRdP",
69
- RootIndex: "0CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E752",
70
- index: "0B4A2E68C111F7E42FAEEE405F7344560C8240840B151D9D04131EB79D080167",
71
- };
67
+ LedgerEntryType: 'DirectoryNode',
68
+ Owner: 'rHzDaMNybxQppiE3uWyt2N265KvAKdiRdP',
69
+ RootIndex: '0CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E752',
70
+ index: '0B4A2E68C111F7E42FAEEE405F7344560C8240840B151D9D04131EB79D080167',
71
+ }
72
72
 
73
73
  const binaryEntry2 =
74
- "1100722200210000250178D1CA37000000000000000038000000000000028355C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D66946280000000000000000000000000000000000000004743420000000000000000000000000000000000000000000000000166D6071AFD498D000000000000000000000000000047434200000000002599D1D255BCA61189CA64C84528F2FCBE4BFC3867800000000000000000000000000000000000000047434200000000006EEBB1D1852CE667876A0B3630861FB6C6AB358E";
74
+ '1100722200210000250178D1CA37000000000000000038000000000000028355C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D66946280000000000000000000000000000000000000004743420000000000000000000000000000000000000000000000000166D6071AFD498D000000000000000000000000000047434200000000002599D1D255BCA61189CA64C84528F2FCBE4BFC3867800000000000000000000000000000000000000047434200000000006EEBB1D1852CE667876A0B3630861FB6C6AB358E'
75
75
  const jsonEntry2 = {
76
76
  Balance: {
77
- currency: "GCB",
78
- issuer: "rrrrrrrrrrrrrrrrrrrrBZbvji",
79
- value: "0",
77
+ currency: 'GCB',
78
+ issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
79
+ value: '0',
80
80
  },
81
81
  Flags: 2162688,
82
82
  HighLimit: {
83
- currency: "GCB",
84
- issuer: "rBfVgTnsdh8ckC19RM8aVGNuMZnpwrMP6n",
85
- value: "0",
83
+ currency: 'GCB',
84
+ issuer: 'rBfVgTnsdh8ckC19RM8aVGNuMZnpwrMP6n',
85
+ value: '0',
86
86
  },
87
- HighNode: "283",
88
- LedgerEntryType: "RippleState",
87
+ HighNode: '283',
88
+ LedgerEntryType: 'RippleState',
89
89
  LowLimit: {
90
- currency: "GCB",
91
- issuer: "rhRFGCy2RJTA8oxkjjtYTvofPVGqcgvXWj",
92
- value: "2000000",
90
+ currency: 'GCB',
91
+ issuer: 'rhRFGCy2RJTA8oxkjjtYTvofPVGqcgvXWj',
92
+ value: '2000000',
93
93
  },
94
- LowNode: "0",
94
+ LowNode: '0',
95
95
  PreviousTxnID:
96
- "C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D6694",
96
+ 'C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D6694',
97
97
  PreviousTxnLgrSeq: 24695242,
98
- index: "0000041EFD027808D3F78C8352F97E324CB816318E00B977C74ECDDC7CD975B2",
99
- };
100
-
101
- test("compareToTests[0]", () => {
102
- expect(UInt8.from(124).compareTo(UInt64.from(124))).toBe(0);
103
- });
104
-
105
- test("compareToTest[1]", () => {
106
- expect(UInt64.from(124).compareTo(UInt8.from(124))).toBe(0);
107
- });
108
-
109
- test("compareToTest[2]", () => {
110
- expect(UInt64.from(124).compareTo(UInt8.from(123))).toBe(1);
111
- });
112
-
113
- test("compareToTest[3]", () => {
114
- expect(UInt8.from(124).compareTo(UInt8.from(13))).toBe(1);
115
- });
116
-
117
- test("compareToTest[4]", () => {
118
- expect(UInt8.from(124).compareTo(124)).toBe(0);
119
- });
120
-
121
- test("compareToTest[5]", () => {
122
- expect(UInt64.from(124).compareTo(124)).toBe(0);
123
- });
124
-
125
- test("compareToTest[6]", () => {
126
- expect(UInt64.from(124).compareTo(123)).toBe(1);
127
- });
128
-
129
- test("compareToTest[7]", () => {
130
- expect(UInt8.from(124).compareTo(13)).toBe(1);
131
- });
132
-
133
- test("UInt64 from string zero", () => {
134
- expect(UInt64.from("0")).toEqual(UInt64.from(0));
135
- expect(encode(json)).toEqual(binary);
136
- });
137
-
138
- test("UInt64 from non 16 length hex", () => {
139
- expect(encode(jsonEntry0)).toEqual(binaryEntry0);
140
- expect(encode(jsonEntry1)).toEqual(binaryEntry1);
141
- expect(encode(jsonEntry2)).toEqual(binaryEntry2);
142
- });
143
-
144
- test("valueOfTests", () => {
145
- let val = UInt8.from(1);
146
- val |= 0x2;
147
- expect(val).toBe(3);
148
- });
98
+ index: '0000041EFD027808D3F78C8352F97E324CB816318E00B977C74ECDDC7CD975B2',
99
+ }
100
+
101
+ test('compareToTests[0]', () => {
102
+ expect(UInt8.from(124).compareTo(UInt64.from(124))).toBe(0)
103
+ })
104
+
105
+ test('compareToTest[1]', () => {
106
+ expect(UInt64.from(124).compareTo(UInt8.from(124))).toBe(0)
107
+ })
108
+
109
+ test('compareToTest[2]', () => {
110
+ expect(UInt64.from(124).compareTo(UInt8.from(123))).toBe(1)
111
+ })
112
+
113
+ test('compareToTest[3]', () => {
114
+ expect(UInt8.from(124).compareTo(UInt8.from(13))).toBe(1)
115
+ })
116
+
117
+ test('compareToTest[4]', () => {
118
+ expect(UInt8.from(124).compareTo(124)).toBe(0)
119
+ })
120
+
121
+ test('compareToTest[5]', () => {
122
+ expect(UInt64.from(124).compareTo(124)).toBe(0)
123
+ })
124
+
125
+ test('compareToTest[6]', () => {
126
+ expect(UInt64.from(124).compareTo(123)).toBe(1)
127
+ })
128
+
129
+ test('compareToTest[7]', () => {
130
+ expect(UInt8.from(124).compareTo(13)).toBe(1)
131
+ })
132
+
133
+ test('UInt64 from string zero', () => {
134
+ expect(UInt64.from('0')).toEqual(UInt64.from(0))
135
+ expect(encode(json)).toEqual(binary)
136
+ })
137
+
138
+ test('UInt64 from non 16 length hex', () => {
139
+ expect(encode(jsonEntry0)).toEqual(binaryEntry0)
140
+ expect(encode(jsonEntry1)).toEqual(binaryEntry1)
141
+ expect(encode(jsonEntry2)).toEqual(binaryEntry2)
142
+ })
143
+
144
+ test('valueOfTests', () => {
145
+ let val = UInt8.from(1)
146
+ val |= 0x2
147
+ expect(val).toBe(3)
148
+ })
@@ -1,181 +1,181 @@
1
- const { encode, decode } = require("./../dist/index");
2
- const fixtures = require("./fixtures/x-codec-fixtures.json");
1
+ const { encode, decode } = require('./../dist/index')
2
+ const fixtures = require('./fixtures/x-codec-fixtures.json')
3
3
 
4
4
  let json_x1 = {
5
5
  OwnerCount: 0,
6
- Account: "XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT",
6
+ Account: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
7
7
  PreviousTxnLgrSeq: 7,
8
- LedgerEntryType: "AccountRoot",
8
+ LedgerEntryType: 'AccountRoot',
9
9
  PreviousTxnID:
10
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
10
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
11
11
  Flags: 0,
12
12
  Sequence: 1,
13
- Balance: "10000000000",
14
- };
13
+ Balance: '10000000000',
14
+ }
15
15
 
16
16
  let json_r1 = {
17
17
  OwnerCount: 0,
18
- Account: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
18
+ Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
19
19
  PreviousTxnLgrSeq: 7,
20
- LedgerEntryType: "AccountRoot",
20
+ LedgerEntryType: 'AccountRoot',
21
21
  PreviousTxnID:
22
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
22
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
23
23
  Flags: 0,
24
24
  Sequence: 1,
25
- Balance: "10000000000",
25
+ Balance: '10000000000',
26
26
  SourceTag: 12345,
27
- };
27
+ }
28
28
 
29
29
  let json_null_x = {
30
30
  OwnerCount: 0,
31
- Account: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
32
- Destination: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
33
- Issuer: "XVXdn5wEVm5G4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71",
31
+ Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
32
+ Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
33
+ Issuer: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71',
34
34
  PreviousTxnLgrSeq: 7,
35
- LedgerEntryType: "AccountRoot",
35
+ LedgerEntryType: 'AccountRoot',
36
36
  PreviousTxnID:
37
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
37
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
38
38
  Flags: 0,
39
39
  Sequence: 1,
40
- Balance: "10000000000",
41
- };
40
+ Balance: '10000000000',
41
+ }
42
42
 
43
43
  let json_invalid_x = {
44
44
  OwnerCount: 0,
45
- Account: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
46
- Destination: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
47
- Issuer: "XVXdn5wEVm5g4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71",
45
+ Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
46
+ Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
47
+ Issuer: 'XVXdn5wEVm5g4UhEHWDPqjvdeH361P4GETfNyyXGaoqBj71',
48
48
  PreviousTxnLgrSeq: 7,
49
- LedgerEntryType: "AccountRoot",
49
+ LedgerEntryType: 'AccountRoot',
50
50
  PreviousTxnID:
51
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
51
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
52
52
  Flags: 0,
53
53
  Sequence: 1,
54
- Balance: "10000000000",
55
- };
54
+ Balance: '10000000000',
55
+ }
56
56
 
57
57
  let json_null_r = {
58
58
  OwnerCount: 0,
59
- Account: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
60
- Destination: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
61
- Issuer: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
59
+ Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
60
+ Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
61
+ Issuer: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
62
62
  PreviousTxnLgrSeq: 7,
63
- LedgerEntryType: "AccountRoot",
63
+ LedgerEntryType: 'AccountRoot',
64
64
  PreviousTxnID:
65
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
65
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
66
66
  Flags: 0,
67
67
  Sequence: 1,
68
- Balance: "10000000000",
69
- };
68
+ Balance: '10000000000',
69
+ }
70
70
 
71
71
  let invalid_json_issuer_tagged = {
72
72
  OwnerCount: 0,
73
- Account: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
74
- Destination: "rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv",
75
- Issuer: "XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT",
73
+ Account: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
74
+ Destination: 'rLs1MzkFWCxTbuAHgjeTZK4fcCDDnf2KRv',
75
+ Issuer: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
76
76
  PreviousTxnLgrSeq: 7,
77
- LedgerEntryType: "AccountRoot",
77
+ LedgerEntryType: 'AccountRoot',
78
78
  PreviousTxnID:
79
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
79
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
80
80
  Flags: 0,
81
81
  Sequence: 1,
82
- Balance: "10000000000",
83
- };
82
+ Balance: '10000000000',
83
+ }
84
84
 
85
85
  let invalid_json_x_and_tagged = {
86
86
  OwnerCount: 0,
87
- Account: "XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT",
87
+ Account: 'XVXdn5wEVm5G4UhEHWDPqjvdeH361P7BsapL4m2D2XnPSwT',
88
88
  PreviousTxnLgrSeq: 7,
89
- LedgerEntryType: "AccountRoot",
89
+ LedgerEntryType: 'AccountRoot',
90
90
  PreviousTxnID:
91
- "DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF",
91
+ 'DF530FB14C5304852F20080B0A8EEF3A6BDD044F41F4EBBD68B8B321145FE4FF',
92
92
  Flags: 0,
93
93
  Sequence: 1,
94
- Balance: "10000000000",
94
+ Balance: '10000000000',
95
95
  SourceTag: 12345,
96
- };
96
+ }
97
97
 
98
98
  let json_issued_x = {
99
99
  TakerPays: {
100
- currency: "USD",
101
- issuer: "X7WZKEeNVS2p9Tire9DtNFkzWBZbFtJHWxDjN9fCrBGqVA4",
102
- value: "7072.8",
100
+ currency: 'USD',
101
+ issuer: 'X7WZKEeNVS2p9Tire9DtNFkzWBZbFtJHWxDjN9fCrBGqVA4',
102
+ value: '7072.8',
103
103
  },
104
- };
104
+ }
105
105
 
106
106
  let json_issued_r = {
107
107
  TakerPays: {
108
- currency: "USD",
109
- issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
110
- value: "7072.8",
108
+ currency: 'USD',
109
+ issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
110
+ value: '7072.8',
111
111
  },
112
- };
112
+ }
113
113
 
114
114
  let json_issued_with_tag = {
115
115
  TakerPays: {
116
- currency: "USD",
117
- issuer: "X7WZKEeNVS2p9Tire9DtNFkzWBZbFtSiS2eDBib7svZXuc2",
118
- value: "7072.8",
116
+ currency: 'USD',
117
+ issuer: 'X7WZKEeNVS2p9Tire9DtNFkzWBZbFtSiS2eDBib7svZXuc2',
118
+ value: '7072.8',
119
119
  },
120
- };
121
-
122
- describe("X-Address Account is equivalent to a classic address w/ SourceTag", () => {
123
- let encoded_x = encode(json_x1);
124
- let encoded_r = encode(json_r1);
125
- test("Can encode with x-Address", () => {
126
- expect(encoded_x).toEqual(encoded_r);
127
- });
128
-
129
- test("decoded X-address is object w/ source and tag", () => {
130
- let decoded_x = decode(encoded_x);
131
- expect(decoded_x).toEqual(json_r1);
132
- });
133
-
134
- test("Encoding issuer X-Address w/ undefined destination tag", () => {
135
- expect(encode(json_null_x)).toEqual(encode(json_null_r));
136
- });
137
-
138
- test("Throws when X-Address is invalid", () => {
139
- expect(() => encode(json_invalid_x)).toThrow("checksum_invalid");
140
- });
141
-
142
- test("Encodes issued currency w/ x-address", () => {
143
- expect(encode(json_issued_x)).toEqual(encode(json_issued_r));
144
- });
145
- });
146
-
147
- describe("Invalid X-Address behavior", () => {
148
- test("X-Address with tag throws value for invalid field", () => {
120
+ }
121
+
122
+ describe('X-Address Account is equivalent to a classic address w/ SourceTag', () => {
123
+ let encoded_x = encode(json_x1)
124
+ let encoded_r = encode(json_r1)
125
+ test('Can encode with x-Address', () => {
126
+ expect(encoded_x).toEqual(encoded_r)
127
+ })
128
+
129
+ test('decoded X-address is object w/ source and tag', () => {
130
+ let decoded_x = decode(encoded_x)
131
+ expect(decoded_x).toEqual(json_r1)
132
+ })
133
+
134
+ test('Encoding issuer X-Address w/ undefined destination tag', () => {
135
+ expect(encode(json_null_x)).toEqual(encode(json_null_r))
136
+ })
137
+
138
+ test('Throws when X-Address is invalid', () => {
139
+ expect(() => encode(json_invalid_x)).toThrow('checksum_invalid')
140
+ })
141
+
142
+ test('Encodes issued currency w/ x-address', () => {
143
+ expect(encode(json_issued_x)).toEqual(encode(json_issued_r))
144
+ })
145
+ })
146
+
147
+ describe('Invalid X-Address behavior', () => {
148
+ test('X-Address with tag throws value for invalid field', () => {
149
149
  expect(() => encode(invalid_json_issuer_tagged)).toThrow(
150
- new Error("Issuer cannot have an associated tag")
151
- );
152
- });
150
+ new Error('Issuer cannot have an associated tag'),
151
+ )
152
+ })
153
153
 
154
- test("Throws when Account has both X-Addr and Destination Tag", () => {
154
+ test('Throws when Account has both X-Addr and Destination Tag', () => {
155
155
  expect(() => encode(invalid_json_x_and_tagged)).toThrow(
156
- new Error("Cannot have Account X-Address and SourceTag")
157
- );
158
- });
156
+ new Error('Cannot have Account X-Address and SourceTag'),
157
+ )
158
+ })
159
159
 
160
- test("Throws when issued currency has tag", () => {
160
+ test('Throws when issued currency has tag', () => {
161
161
  expect(() => encode(json_issued_with_tag)).toThrow(
162
- "Only allowed to have tag on Account or Destination"
163
- );
164
- });
165
- });
162
+ 'Only allowed to have tag on Account or Destination',
163
+ )
164
+ })
165
+ })
166
166
 
167
- describe("ripple-binary-codec x-address test", function () {
167
+ describe('ripple-binary-codec x-address test', function () {
168
168
  function makeSuite(name, entries) {
169
169
  describe(name, function () {
170
170
  entries.forEach((t, testN) => {
171
171
  test(`${name}[${testN}] encodes X-address json equivalent to classic address json`, () => {
172
- expect(encode(t.rjson)).toEqual(encode(t.xjson));
173
- });
172
+ expect(encode(t.rjson)).toEqual(encode(t.xjson))
173
+ })
174
174
  test(`${name}[${testN}] decodes X-address json equivalent to classic address json`, () => {
175
- expect(decode(encode(t.xjson))).toEqual(t.rjson);
176
- });
177
- });
178
- });
175
+ expect(decode(encode(t.xjson))).toEqual(t.rjson)
176
+ })
177
+ })
178
+ })
179
179
  }
180
- makeSuite("transactions", fixtures.transactions);
181
- });
180
+ makeSuite('transactions', fixtures.transactions)
181
+ })
package/HISTORY.md DELETED
@@ -1,90 +0,0 @@
1
- # ripple-binary-codec Release History
2
-
3
- ## 1.1.3 (2021-06-11)
4
- - Fix for case UInt64.from string allowing lowercase hex (#135)
5
- - Fix for `ValidatorToReEnable` field code (#130)
6
-
7
- ## 1.1.2 (2021-03-10)
8
- - Fix for case UInt64.from string '0' due to changes in rippled 1.7.0
9
-
10
- ## 1.1.1 (2021-02-12)
11
- - PathSet.toJSON() does not return undefined values
12
- - Add support for X-Addresses in Issued Currency Amounts
13
- - Fix STArray error message
14
-
15
- ## 1.1.0 (2020-12-03)
16
- - Add support for Tickets (TicketBatch amendment)
17
- - Fix web browser compatibility
18
-
19
- ## 1.0.2 (2020-09-11)
20
- - Allow currencies to be encoded from any 3 character ASCII code
21
-
22
- ## 1.0.1 (2020-09-08)
23
- - Filter out fields with undefined values
24
-
25
- ## 1.0.0 (2020-08-17)
26
-
27
- - Migrate to TypeScript
28
- - Javascript classes used
29
- - Generics for constructing core types
30
- - Reduced dependencies
31
- - Dependent on create-hash, decimal.js, ripple-address-codec
32
- - Migrate testing to Jest and added tests
33
- - Tests for pseudo-transactions
34
- - Added support for NegativeUNL pseudo-transactions
35
-
36
- ## 0.2.6 (2019-12-31)
37
-
38
- - Update dependencies
39
- - decimal.js, fs-extra, mocha, handlebars, bn.js, babel-eslint, ripple-address-codec
40
-
41
- ## 0.2.5 (2019-12-14)
42
-
43
- - Add support for AccountDelete (#37)
44
-
45
- ## 0.2.4 (2019-09-04)
46
-
47
- - Update ripple-address-codec to 3.0.4
48
-
49
- ## 0.2.3 (2019-08-29)
50
-
51
- - Expand node version compatibility (#32, #33)
52
-
53
- ## 0.2.2 (2019-07-26)
54
-
55
- - Input validation - Amount and Fee should not allow fractional XRP drops ([#31](https://github.com/ripple/ripple-binary-codec/issues/31))
56
- - Fix lint errors
57
- - Update dependencies (including lodash and mocha)
58
- - Require node 10 (.nvmrc)
59
- - Remove assert-diff
60
- - Remove codecov.io as it did not appear to work. The `package.json` script was:
61
- - `"codecov": "cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js"`
62
-
63
- ## 0.2.1
64
-
65
- - Add tecKILLED from amendment fix1578 (PR #27 fixes #25)
66
-
67
- ## 0.2.0
68
-
69
- - Add DepositPreauth fields
70
- - https://developers.ripple.com/depositauth.html
71
-
72
- ## 0.1.14
73
-
74
- - Skip amount validation when deserializing f72c115
75
-
76
- ## 0.1.13
77
-
78
- - Add Check, CheckCreate, CheckCash, CheckCancel
79
-
80
- ## 0.1.11
81
-
82
- - Add ledger header decode function
83
-
84
- ## 0.1.8
85
-
86
- ## 0.1.7
87
-
88
- ## 0.1.6
89
-
90
- ## 0.1.3