@transia/ripple-binary-codec 1.4.6-alpha.0 → 1.4.6-alpha.10

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.
@@ -0,0 +1,89 @@
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
+ }
package/test/hash.test.js CHANGED
@@ -77,7 +77,7 @@ describe('Hash256', function () {
77
77
 
78
78
  describe('Currency', function () {
79
79
  test('Decoding allows dodgy XRP without throwing', function () {
80
- const currencyCode = '0000000000000000000000005852500000000000'
80
+ const currencyCode = '0000000000000000000000005841480000000000'
81
81
  expect(Currency.from(currencyCode).toJSON()).toBe(currencyCode)
82
82
  })
83
83
  test('Currency code with lowercase letters decodes to ISO code', () => {
@@ -113,7 +113,7 @@ describe('Currency', function () {
113
113
 
114
114
  test('can be constructed from a Buffer', function () {
115
115
  const xrp = new Currency(Buffer.alloc(20))
116
- expect(xrp.iso()).toBe('XRP')
116
+ expect(xrp.iso()).toBe('XAH')
117
117
  })
118
118
  test('Can handle non-standard currency codes', () => {
119
119
  const currency = '015841551A748AD2C1F76FF6ECB0CCCD00000000'
@@ -170,62 +170,31 @@ describe('Signing data', function () {
170
170
  ].join(''),
171
171
  )
172
172
  })
173
-
174
- test('can create multi signing blobs with custom definitions', function () {
175
- const customPaymentDefinitions = JSON.parse(
176
- JSON.stringify(normalDefinitions),
177
- )
178
- customPaymentDefinitions.TRANSACTION_TYPES.Payment = 31
179
-
180
- const newDefs = new XrplDefinitions(customPaymentDefinitions)
181
- const signingAccount = 'rJZdUusLDtY9NEsGea7ijqhVrXv98rYBYN'
182
- const signingJson = { ...tx_json, SigningPubKey: '' }
183
- const actual = encodeForMultisigning(signingJson, signingAccount, newDefs)
173
+ test('can create native claim blob', function () {
174
+ const channel =
175
+ '43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
176
+ const amount = '1000'
177
+ const json = { channel, amount }
178
+ const actual = encodeForSigningClaim(json)
184
179
  expect(actual).toBe(
185
180
  [
186
- '534D5400', // signingPrefix
187
- // TransactionType
188
- '12',
189
- '001F',
190
- // Flags
191
- '22',
192
- '80000000',
193
- // Sequence
194
- '24',
195
- '00000001',
196
- // Amount
197
- '61',
198
- // native amount
199
- '40000000000003E8',
200
- // Fee
201
- '68',
202
- // native amount
203
- '400000000000000A',
204
- // SigningPubKey
205
- '73',
206
- // VLLength
207
- '00',
208
- // '',
209
- // Account
210
- '81',
211
- // VLLength
212
- '14',
213
- '5B812C9D57731E27A2DA8B1830195F88EF32A3B6',
214
- // Destination
215
- '83',
216
- // VLLength
217
- '14',
218
- 'B5F762798A53D543A014CAF8B297CFF8F2F937E8',
219
- // signingAccount suffix
220
- 'C0A5ABEF242802EFED4B041E8F2D4A8CC86AE3D1',
181
+ // hash prefix
182
+ '434C4D00',
183
+ // channel ID
184
+ '43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1',
185
+ // amount as a uint64
186
+ '00000000000003E8',
221
187
  ].join(''),
222
188
  )
223
189
  })
224
-
225
- test('can create claim blob', function () {
190
+ test('can create ic claim blob', function () {
226
191
  const channel =
227
192
  '43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1'
228
- const amount = '1000'
193
+ const amount = {
194
+ issuer: 'rJZdUusLDtY9NEsGea7ijqhVrXv98rYBYN',
195
+ currency: 'USD',
196
+ value: '10',
197
+ }
229
198
  const json = { channel, amount }
230
199
  const actual = encodeForSigningClaim(json)
231
200
  expect(actual).toBe(
@@ -235,7 +204,9 @@ describe('Signing data', function () {
235
204
  // channel ID
236
205
  '43904CBFCDCEC530B4037871F86EE90BF799DF8D2E0EA564BC8A3F332E4F5FB1',
237
206
  // amount as a uint64
238
- '00000000000003E8',
207
+ 'D4C38D7EA4C680000000000000000000000000005553440000000000C0A5ABEF',
208
+ // amount as a uint64
209
+ '242802EFED4B041E8F2D4A8CC86AE3D1',
239
210
  ].join(''),
240
211
  )
241
212
  })
@@ -58,7 +58,7 @@ describe('encoding and decoding tx_json', function () {
58
58
  Sequence: 19,
59
59
  LimitAmount: {
60
60
  value: '200',
61
- currency: '0000000000000000000000005852500000000000',
61
+ currency: '0000000000000000000000005841480000000000',
62
62
  issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
63
63
  },
64
64
  Fee: '10',