Add short description to all types on overview page (#849)

* Smaller typos/ wording

* Grammar An - A

* Add short description to each type on overview page WIP

* Removed 'Derived types' section because HeaderExtended was the only derived method left

* Commit current state

* Description completed

* Removed empty row placeholder

* Fixed Typo in LockPeriods

* Spell out Little Endian

* Fixed accidentaly removed space character
This commit is contained in:
Stefanie Doll
2019-04-23 13:07:56 +02:00
committed by GitHub
parent ff25a85ac2
commit c085d01d00
24 changed files with 180 additions and 39 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import { assert } from '@polkadot/util';
import U32 from '../primitive/U32';
export const MAGIC_NUMBER = new U32(0x6174656d); // `meta`, reversed for LE encoding
export const MAGIC_NUMBER = new U32(0x6174656d); // `meta`, reversed for Little Endian encoding
export const MAGIC_ERROR = -61746;
export default class MagicNumber extends U32 {
+1 -1
View File
@@ -44,7 +44,7 @@ export default abstract class AbstractInt extends BN implements Codec {
return hexToBn(value, { isLe: false, isNegative }).toString();
} else if (isU8a(value)) {
try {
// NOTE When passing u8a in (typically from decoded data), it is always LE
// NOTE When passing u8a in (typically from decoded data), it is always Little Endian
return u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative }).toString();
} catch (error) {
console.error(`AbstractInt value decoding failed ${error.message}`, value);
+2 -2
View File
@@ -17,13 +17,13 @@ describe('Int', () => {
).toEqual(-1234);
});
it('converts to LE from the provided value', () => {
it('converts to Little Endian from the provided value', () => {
expect(
new Int(-1234).toU8a()
).toEqual(new Uint8Array([46, 251, 255, 255, 255, 255, 255, 255]));
});
it('converts to LE from the provided value (bitLength)', () => {
it('converts to Little Endian from the provided value (bitLength)', () => {
expect(
new Int(-1234, 32).toU8a()
).toEqual(new Uint8Array([46, 251, 255, 255]));
+1 -1
View File
@@ -11,7 +11,7 @@ import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
/**
* @name Int
* @description
* A generic signed integer codec. For Substrate all numbers are LE encoded,
* A generic signed integer codec. For Substrate all numbers are Little Endian encoded,
* this handles the encoding and decoding of those numbers. Upon construction
* the bitLength is provided and any additional use keeps the number to this
* length. This extends `BN`, so all methods available on a normal `BN` object
+1 -1
View File
@@ -10,7 +10,7 @@ import { compareMap, decodeU8a } from './utils';
/**
* @name Struct
* @description
* A Struct defines an Object with key/values - where the values are Codec values. It removes
* A Struct defines an Object with key-value pairs - where the values are Codec values. It removes
* a lot of repetition from the actual coding, define a structure type, pass it the key/Codec
* values in the constructor and it manages the decoding. It is important that the constructor
* values matches 100% to the order in th Rust code, i.e. don't go crazy and make it alphabetical,
+2 -2
View File
@@ -10,8 +10,8 @@ import { AnyU8a, Codec } from '../types';
* @name U8a
* @description
* A basic wrapper around Uint8Array, with no frills and no fuss. It does differ
* from other implementations wher it will consume the full Uint8Array as passed to
* it. As such it is meant to be subclassed where the wrapper takes care of the
* from other implementations where it will consume the full Uint8Array as passed to it.
* As such it is meant to be subclassed where the wrapper takes care of the
* actual lengths instead of used directly.
* @noInheritDoc
*/
+2 -2
View File
@@ -19,13 +19,13 @@ describe('UInt', () => {
).toEqual(4567);
});
it('converts to LE from the provided value', () => {
it('converts to Little Endian from the provided value', () => {
expect(
new UInt(1234567).toU8a()
).toEqual(new Uint8Array([135, 214, 18, 0, 0, 0, 0, 0]));
});
it('converts to LE from the provided value (bitLength)', () => {
it('converts to Little Endian from the provided value (bitLength)', () => {
expect(
new UInt(1234567, 32).toU8a()
).toEqual(new Uint8Array([135, 214, 18, 0]));
+1 -1
View File
@@ -11,7 +11,7 @@ import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
/**
* @name UInt
* @description
* A generic unsigned integer codec. For Substrate all numbers are LE encoded,
* A generic unsigned integer codec. For Substrate all numbers are Little Endian encoded,
* this handles the encoding and decoding of those numbers. Upon construction
* the bitLength is provided and any additional use keeps the number to this
* length. This extends `BN`, so all methods available on a normal `BN` object
+1 -1
View File
@@ -9,7 +9,7 @@ import Int from '../codec/Int';
/**
* @name I128
* @description
* An 128-bit signed integer
* A 128-bit signed integer
*/
export default class I128 extends Int {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import Int from '../codec/Int';
/**
* @name I16
* @description
* An 16-bit signed integer
* A 16-bit signed integer
*/
export default class I16 extends Int {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import Int from '../codec/Int';
/**
* @name I256
* @description
* An 256-bit signed integer
* A 256-bit signed integer
*/
export default class I256 extends Int {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import Int from '../codec/Int';
/**
* @name I32
* @description
* An 32-bit signed integer
* A 32-bit signed integer
*/
export default class I32 extends Int {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import Int from '../codec/Int';
/**
* @name I64
* @description
* An 64-bit signed integer
* A 64-bit signed integer
*/
export default class I64 extends Int {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -7,7 +7,7 @@ import Bytes from './Bytes';
/**
* @name StorageData
* @description
* Data retrieved via Storage queries and data for KeyValue pairs
* Data retrieved via Storage queries and data for key-value pairs
*/
export default class StorageData extends Bytes {
}
+1 -1
View File
@@ -9,7 +9,7 @@ import UInt from '../codec/UInt';
/**
* @name U128
* @description
* An 128-bit unsigned integer
* A 128-bit unsigned integer
*/
export default class U128 extends UInt {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import UInt from '../codec/UInt';
/**
* @name U16
* @description
* An 16-bit unsigned integer
* A 16-bit unsigned integer
*/
export default class U16 extends UInt {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import UInt from '../codec/UInt';
/**
* @name U256
* @description
* An 256-bit unsigned integer
* A 256-bit unsigned integer
*/
export default class U256 extends UInt {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import UInt from '../codec/UInt';
/**
* @name U32
* @description
* An 32-bit unsigned integer
* A 32-bit unsigned integer
*/
export default class U32 extends UInt {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -9,7 +9,7 @@ import UInt from '../codec/UInt';
/**
* @name U64
* @description
* An 64-bit unsigned integer
* A 64-bit unsigned integer
*/
export default class U64 extends UInt {
constructor (value?: AnyNumber) {
+1 -1
View File
@@ -18,7 +18,7 @@ type KeyValueValue = {
/**
* @name KeyValue
* @description
* KeyValue structure. Since most of the keys and resultant values in Subtrate is
* KeyValue structure. Since most of the keys and resultant values in Subtrate are
* hashed and/or encoded, this does not wrap [[Text]], but rather a [[Bytes]]
* for the keys and values. (Not to be confused with the KeyValue in [[Metadata]], that
* is actually for Maps, whereas this is a representation of actaul storage values)
+2 -2
View File
@@ -5,9 +5,9 @@
import I8 from '../primitive/I8';
/**
* @name LocKPeriods
* @name LockPeriods
* @description
* A number of lock periods.
*/
export default class LocKPeriods extends I8 {
export default class LockPeriods extends I8 {
}
+1 -1
View File
@@ -25,7 +25,7 @@ type SignaturePayloadValue = {
* @name SignaturePayload
* @description
* A signing payload for an [[Extrinsic]]. For the final encoding, it is variable length based
* on the conetnts included
* on the contents included
*
* 8 bytes: The Transaction Index/Nonce as provided in the transaction itself.
* 2+ bytes: The Function Descriptor as provided in the transaction itself.