Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function decodeRaw (u8a: Uint8Array): RawData {
// tslint:disable-next-line:variable-name
const { body, header, number } = decodeHeader(u8a);
const length = u8aToBn(body.subarray(0, 4), true).toNumber();
const extrinsics = [];
let offset = 4;
for (let index = 0; index < length; index++) {
const extrinsic = decodeExtrinsic(
body.subarray(offset)
);
offset += extrinsic.length + 4;
extrinsics.push(extrinsic);
}
return {
body,
extrinsics,
header,
number
};
}