* Add documentation * Justification u8a decoding and json encoding (#146) * Decode Justifications * Json encoding for justifications * Bump deps * Allow extrinsic length encoding to operate on u8a[] (#148) * Fix config and move generated doc to a subfolder * Cleanup extrinsic encoding (#150) * Cleanup extrinsic encoding * Removed now-defunct type * Add uncheckedLength encoding * Add examples * Ignore package-lock since we use yarn * Cleanup examples * Add gitbook config and some base files for the doc * Do not make full doc mandatory for now * Add contributing guide, polish doc and samples * Update the deps of all samples and add yarn scripts Fix and regenerate the doc * Fix Contributing guide
26 KiB
Index
Type aliases
- BlockDecoded
- BlockExtrinsicDecoded
- BlockJustificationDecoded
- CreateItem
- CreateItemOptions
- CreateItemOptionsMap
- CreateItems
- CreateSection
- CreateSectionOptions
- CreateSectionOptions$Fn
- CreateSectionOptions$Only
- Decoder
- EncodingVersions
- ExtrinsicDecoded
- KeyValue
- Param
- Param$Decoded
- Param$Options
- Param$Type
- Param$Type$Array
- Param$Types
- Param$Value
- Param$Value$Array
- Param$Values
- Params
- Section
- SectionItem
- SectionItems
- Sections
Functions
- accountId
- bn
- bool
- byte
- bytes
- call
- code
- createMethod
- createParam
- createSection
- decode
- decodeValue
- digest
- encodeParam
- encodeParams
- encodeType
- header
- keyValue
- misbehavior
- passThrough
- signature
- storageKey
- string
- time
- typeToString
- u8a
Type aliases
BlockDecoded
Ƭ BlockDecoded: object
Defined in types.d.ts:45
Type declaration
BlockExtrinsicDecoded
Ƭ BlockExtrinsicDecoded: object
Defined in types.d.ts:28
Type declaration
BlockJustificationDecoded
Ƭ BlockJustificationDecoded: object
Defined in types.d.ts:36
Type declaration
CreateItem
Ƭ CreateItem: function
Defined in types.d.ts:127
Type declaration
▸(options: CreateItemOptions): SectionItem<T>
Parameters:
| Param | Type |
|---|---|
| options | CreateItemOptions |
Returns: SectionItem<T>
CreateItemOptions
Ƭ CreateItemOptions: object
Defined in types.d.ts:111
Type declaration
CreateItemOptionsMap
Ƭ CreateItemOptionsMap: object
Defined in types.d.ts:123
Type declaration
CreateItems
Ƭ CreateItems: function
Defined in types.d.ts:129
Type declaration
▸(name: string, index?: * undefined | number*): CreateItem<T>
Parameters:
| Param | Type |
|---|---|
| name | string |
Optional index |
undefined | number |
Returns: CreateItem<T>
CreateSection
Ƭ CreateSection: function
Defined in types.d.ts:143
Type declaration
▸(options: CreateSectionOptions<T, Priv, Pub>): Section<T, Priv, Pub>
Parameters:
| Param | Type |
|---|---|
| options | CreateSectionOptions<T, Priv, Pub> |
Returns: Section<T, Priv, Pub>
CreateSectionOptions
Ƭ CreateSectionOptions: * CreateSectionOptions$Only<T, Priv, Pub> | CreateSectionOptions$Fn<T, Priv, Pub>
*
Defined in types.d.ts:141
CreateSectionOptions$Fn
Ƭ CreateSectionOptions$Fn: function
Defined in types.d.ts:139
Type declaration
▸(method: CreateItems<T>): CreateSectionOptions$Only<T, Priv, Pub>
Parameters:
| Param | Type |
|---|---|
| method | CreateItems<T> |
Returns: CreateSectionOptions$Only<T, Priv, Pub>
CreateSectionOptions$Only
Ƭ CreateSectionOptions$Only: object
Defined in types.d.ts:131
Type declaration
Decoder
Ƭ Decoder: function
Defined in decode/types.d.ts:7
Type declaration
▸(type: Param$Types, input: Uint8Array, version: EncodingVersions, isStorage: boolean): Param$Decoded
Parameters:
| Param | Type |
|---|---|
| type | Param$Types |
| input | Uint8Array |
| version | EncodingVersions |
| isStorage | boolean |
Returns: Param$Decoded
EncodingVersions
Ƭ EncodingVersions: * "poc-1" | "latest" *
Defined in types.d.ts:11
ExtrinsicDecoded
Ƭ ExtrinsicDecoded: object
Defined in types.d.ts:23
Type declaration
KeyValue
Ƭ KeyValue: object
Defined in types.d.ts:51
Type declaration
Param
Ƭ Param: * Param$Options & object
*
Defined in types.d.ts:71
Param$Decoded
Ƭ Param$Decoded: object
Defined in types.d.ts:62
Type declaration
Param$Options
Ƭ Param$Options: object
Defined in types.d.ts:67
Type declaration
Param$Type
Ƭ Param$Type: * "AccountId" | "AccountIndex" | "Balance" | "BlockNumber" | "bool" | "Bytes" | "Call" | "CandidateReceipt" | "Code" | "Digest" | "Gas" | "Hash" | "Header" | "KeyValue" | "MisbehaviorReport" | "ParachainId" | "PrendingExtrinsics" | "PropIndex" | "Proposal" | "ReferendumIndex" | "SessionKey" | "Signature" | "SignedBlock" | "StorageKey" | "StorageKeyValue" | "StorageResult" | "StorageResultSet" | "String" | "Timestamp" | "u32" | "u64" | "u128" | "VoteIndex" | "VoteThreshold" *
Defined in types.d.ts:17
Param$Type$Array
Ƭ Param$Type$Array: Array< Param$Type | Array< Param$Type | Array<Param$Type>>>
Defined in types.d.ts:19
Param$Types
Ƭ Param$Types: * Param$Type | Param$Type$Array *
Defined in types.d.ts:21
Param$Value
Ƭ Param$Value: * Digest | Header | KeyValue | MisbehaviorReport | ExtrinsicDecoded | BN | Date | Uint8Array | boolean | number | string | null
*
Defined in types.d.ts:56
Param$Value$Array
Ƭ Param$Value$Array: Array< Param$Value | Array< Param$Value | Array<Param$Value>>>
Defined in types.d.ts:58
Param$Values
Ƭ Param$Values: * Param$Value | Param$Value$Array *
Defined in types.d.ts:60
Params
Ƭ Params: Array<Param>
Defined in types.d.ts:76
Section
Ƭ Section: object
Defined in types.d.ts:99
Type declaration
SectionItem
Ƭ SectionItem: object
Defined in types.d.ts:79
Type declaration
SectionItems
Ƭ SectionItems: object
Defined in types.d.ts:95
Type declaration
Sections
Ƭ Sections: Map<T, Section<T, Priv, Pub>>
Defined in types.d.ts:109
Functions
accountId
▸ accountId(input: * Uint8Array | null | undefined*, version: EncodingVersions, isStorage: boolean): Param$Decoded
Defined in decode/value/accountId.ts:13
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
| version | EncodingVersions |
| isStorage | boolean |
Returns: Param$Decoded
bn
▸ bn(input: * Uint8Array | null | undefined, bitLength: * 32 | 64 | 128): Param$Decoded
Defined in decode/value/bn.ts:10
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
| bitLength | 32 | 64 | 128 |
Returns: Param$Decoded
bool
▸ bool(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/bool.ts:10
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
byte
▸ byte(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/byte.ts:7
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
bytes
▸ bytes(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/bytes.ts:9
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
call
▸ call(decode: Decoder, input: * Uint8Array | null | undefined*, isPublic: boolean, version: EncodingVersions, isStorage: boolean): Param$Decoded
Defined in decode/value/method.ts:19
Parameters:
| Param | Type |
|---|---|
| decode | Decoder |
| input | Uint8Array | null | undefined |
| isPublic | boolean |
| version | EncodingVersions |
| isStorage | boolean |
Returns: Param$Decoded
code
▸ code(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/code.ts:9
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
createMethod
▸ createMethod<T>(section: keyof T, sectionIndex: Uint8Array): CreateItems<T>
Defined in method.ts:11
Type parameters:
T
Parameters:
| Param | Type |
|---|---|
| section | keyof T |
| sectionIndex | Uint8Array |
Returns: CreateItems<T>
createParam
▸ createParam(name: string, type: Param$Types, __namedParameters?: object): Param
Defined in param.ts:7
Parameters:
| Param | Type | Default value |
|---|---|---|
| name | string |
- |
| type | Param$Types | - |
Default value __namedParameters |
object |
{ isOptional: false } |
Returns: Param
createSection
▸ createSection<T>(name: keyof T, _index?: number): CreateSection<T, any, any>
Defined in section.ts:11
Type parameters:
T
Parameters:
| Param | Type | Default value |
|---|---|---|
| name | keyof T |
- |
Default value _index |
number |
0 |
Returns: CreateSection<T, any, any>
decode
▸ decode(type: Param$Types, _input: * Uint8Array | string | null | undefined*, version: EncodingVersions, isStorage?: boolean): Param$Decoded
Defined in decode/index.ts:65
Parameters:
| Param | Type | Default value |
|---|---|---|
| type | Param$Types | - |
| _input | Uint8Array | string | null | undefined |
- |
| version | EncodingVersions | - |
Default value isStorage |
boolean |
false |
Returns: Param$Decoded
decodeValue
▸ decodeValue(decode: Decoder, type: Param$Type, _input: * Uint8Array | string | null | undefined*, version: EncodingVersions, isStorage: boolean): Param$Decoded
Defined in decode/value/index.ts:30
Parameters:
| Param | Type |
|---|---|
| decode | Decoder |
| type | Param$Type |
| _input | Uint8Array | string | null | undefined |
| version | EncodingVersions |
| isStorage | boolean |
Returns: Param$Decoded
digest
▸ digest(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/digest.ts:12
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
encodeParam
▸ encodeParam(param: Param, value: any, version?: EncodingVersions): Uint8Array
Defined in encode/param.ts:14
Parameters:
| Param | Type | Default value |
|---|---|---|
| param | Param | - |
| value | any |
- |
Default value version |
EncodingVersions | "latest" |
Returns: Uint8Array
encodeParams
▸ encodeParams(params: Params, values: Array<any>, version: EncodingVersions): Uint8Array
Defined in encode/index.ts:12
Parameters:
| Param | Type |
|---|---|
| params | Params |
| values | Array<any> |
| version | EncodingVersions |
Returns: Uint8Array
encodeType
▸ encodeType(type: Param$Type, value: any, version: EncodingVersions): Uint8Array
Defined in encode/type/index.ts:19
Parameters:
| Param | Type |
|---|---|
| type | Param$Type |
| value | any |
| version | EncodingVersions |
Returns: Uint8Array
header
▸ header(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/header.ts:9
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
keyValue
▸ keyValue(__namedParameters: object): Uint8Array
Defined in encode/type/keyValue.ts:12
Parameters:
| Param | Type |
|---|---|
| __namedParameters | object |
Returns: Uint8Array
misbehavior
▸ misbehavior(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/misbehavior.ts:21
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
passThrough
▸ passThrough(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/passThrough.ts:7
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
signature
▸ signature<T>(__namedParameters: object): string
Defined in signature.ts:20
name: signature
signature: jsonrpcSignature (method: InterfaceMethodDefinition): string
summary: Returns a string representation of the method with inputs and outputs.
description: Formats the name, inputs and outputs into a human-readable string. This contains the input parameter names input types and output type.
example: import signature from '@polkadot/params/signature';
signature({ name: 'test_method', params: [ { name: 'dest', type: 'Address' } ], type: 'Address' }); // => test_method (dest: Address): Address
Type parameters:
T
Parameters:
| Param | Type |
|---|---|
| __namedParameters | object |
Returns: string
storageKey
▸ storageKey(__namedParameters: [object, Array]): Uint8Array
Defined in encode/type/storageKey.ts:10
Parameters:
| Param | Type |
|---|---|
| __namedParameters | [object, Array] |
Returns: Uint8Array
string
▸ string(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/string.ts:12
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
time
▸ time(input: * Uint8Array | null | undefined*): Param$Decoded
Defined in decode/value/time.ts:9
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
Returns: Param$Decoded
typeToString
▸ typeToString(type: Param$Types): string
Defined in typeToString.ts:7
Parameters:
| Param | Type |
|---|---|
| type | Param$Types |
Returns: string
u8a
▸ u8a(input: * Uint8Array | null | undefined*, bitLength: number, offset: number): Param$Decoded
Defined in decode/value/u8a.ts:7
Parameters:
| Param | Type |
|---|---|
| input | Uint8Array | null | undefined |
| bitLength | number |
| offset | number |
Returns: Param$Decoded