Decode accountIds with prefixes (#136)

* Decode accountIds with prefixes

* Test for extrinsic decoding
This commit is contained in:
Jaco Greeff
2018-08-16 15:02:42 +02:00
committed by GitHub
parent c17ba5c952
commit ed30f76207
4 changed files with 132 additions and 3 deletions
@@ -0,0 +1,27 @@
// Copyright 2017-2018 @polkadot/primitives authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import decode from './decode';
const extrinsics = [
new Uint8Array([
255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 41, 68, 117, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]),
new Uint8Array([
255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]),
new Uint8Array([
255, 77, 4, 166, 251, 34, 133, 176, 143, 12, 198, 201, 222, 181, 12, 200, 97, 198, 90, 180, 149, 151, 27, 224, 180, 14, 209, 39, 82, 19, 43, 128, 246, 16, 0, 0, 0, 2, 3, 255, 234, 26, 21, 20, 14, 86, 45, 159, 88, 43, 56, 214, 77, 141, 31, 87, 91, 159, 131, 117, 86, 253, 236, 64, 252, 195, 229, 100, 37, 148, 113, 199, 54, 163, 211, 184, 103, 79, 218, 214, 142, 212, 194, 213, 30, 205, 144, 202, 98, 169, 249, 42, 218, 178, 115, 60, 189, 224, 37, 129, 199, 179, 25, 68, 43, 230, 218, 86, 161, 223, 189, 1, 170, 86, 36, 118, 21, 90, 182, 34, 135, 60, 104, 202, 1, 12, 105, 28, 88, 227, 177, 1, 37, 220, 50, 14
])
];
describe('extrinsic', () => {
extrinsics.forEach((extrinsic, index) => {
it(`decodes the extrinsic - ${index}`, () => {
const decoded = decode(extrinsic);
expect(decoded).toBeDefined();
});
});
});