Add documentation and examples (#145)
* 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
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
|
||||
[](https://polkadot.js.org)  [](https://github.com/Flet/semistandard) [](https://www.npmjs.com/package/@polkadot/api-format) [](https://travis-ci.org/polkadot-js/api) [](https://codeclimate.com/github/polkadot-js/api/maintainability) [](https://coveralls.io/github/polkadot-js/api?branch=master) [](https://david-dm.org/polkadot-js/api?path=packages/api-format) [](https://david-dm.org/polkadot-js/api?path=packages/api-format#info=devDependencies)
|
||||
|
||||
@polkadot/api-format
|
||||
====================
|
||||
|
||||
Formatters that are used by the application API interface, taking care of transparently formatting parameters (inputs) and the results (output) for requests made over the client RPC interfaces.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Installation -
|
||||
|
||||
```
|
||||
npm install --save @polkadot/api-format
|
||||
```
|
||||
|
||||
## Index
|
||||
|
||||
### Type aliases
|
||||
|
||||
* [FormatterFunction](#formatterfunction)
|
||||
|
||||
### Functions
|
||||
|
||||
* [echo](#echo)
|
||||
* [format](#format)
|
||||
* [formatInputs](#formatinputs)
|
||||
* [formatOutput](#formatoutput)
|
||||
|
||||
---
|
||||
|
||||
## Type aliases
|
||||
|
||||
<a id="formatterfunction"></a>
|
||||
|
||||
### FormatterFunction
|
||||
|
||||
**Ƭ FormatterFunction**: *`function`*
|
||||
|
||||
*Defined in [types.d.ts:7](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-format/src/types.d.ts#L7)*
|
||||
|
||||
#### Type declaration
|
||||
▸(value: *`any`*): `any`
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| value | `any` |
|
||||
|
||||
**Returns:** `any`
|
||||
|
||||
___
|
||||
|
||||
## Functions
|
||||
|
||||
<a id="echo"></a>
|
||||
|
||||
### echo
|
||||
|
||||
▸ **echo**(value: *`any`*): `any`
|
||||
|
||||
*Defined in [echo.ts:10](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-format/src/echo.ts#L10)*
|
||||
|
||||
A function returning any value passed to it
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Description |
|
||||
| ------ | ------ | ------ |
|
||||
| value | `any` | The input value |
|
||||
|
||||
**Returns:** `any`
|
||||
The value passed as input
|
||||
|
||||
___
|
||||
<a id="format"></a>
|
||||
|
||||
### format
|
||||
|
||||
▸ **format**(formatters: *`FormattersFunctionMap`*, types: *`Array`<`Param$Types`>*, values: *`Array`<`any`>*): `Array`<`any`>
|
||||
|
||||
*Defined in [format.ts:49](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-format/src/format.ts#L49)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| formatters | `FormattersFunctionMap` |
|
||||
| types | `Array`<`Param$Types`> |
|
||||
| values | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Array`<`any`>
|
||||
|
||||
___
|
||||
<a id="formatinputs"></a>
|
||||
|
||||
### formatInputs
|
||||
|
||||
▸ **formatInputs**(params: *`Params`*, values: *`Array`<`any`>*): `Array`<`any`>
|
||||
|
||||
*Defined in [input.ts:22](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-format/src/input.ts#L22)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| params | `Params` |
|
||||
| values | `Array`<`any`> |
|
||||
|
||||
**Returns:** `Array`<`any`>
|
||||
|
||||
___
|
||||
<a id="formatoutput"></a>
|
||||
|
||||
### formatOutput
|
||||
|
||||
▸ **formatOutput**(type: *`Param$Types`*, value?: *`any`*): `any` | `null`
|
||||
|
||||
*Defined in [output.ts:30](https://github.com/chevdor/polkadot-js-api/blob/461228c/packages/api-format/src/output.ts#L30)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| type | `Param$Types` |
|
||||
| `Optional` value | `any` |
|
||||
|
||||
**Returns:** `any` | `null`
|
||||
|
||||
___
|
||||
|
||||
Reference in New Issue
Block a user